Object Oriented Programming Tutorials

Roadmap: All Tutorials » C# Tutorials » Object-Oriented Programming Tutorials

Previous: C# Basics Tutorials Homepage
Next: Intermediate C# Tutorials Homepage

One of the key pieces that makes C# as powerful as it is, is the fact that it is an object-oriented programming language. If you don't know what that is yet, don't worry, we'll take a long good look at it before long. In essence, it means that we write little blocks of code that models real world objects, including various properties or attributes of the objects, and what they can do. In this section, we'll also spend a while looking at some of the details of making objects that are based on other objects using inheritance and interfaces.

These tutorials may feel a bit overwhelming at first. On one hand, that's OK. It may take playing around with this stuff for a little bit before really getting a grasp on the ideas and concepts. And it might take going through a tutorial more than once. And on the other hand, if you think something is particularly confusing, please feel free to email me and let me know so that I can make the tutorial easier to understand. Chances are, if you're struggling with it, so is everyone else.

Having said that, let's jump right in!


basics100.png

1 - Classes Part 1: Using Them

This tutorial is the first of several that discuss object oriented programming, starting from scratch. This tutorial covers objects and classes, and how to use them, using the Random class for generating random numbers as an example.
1 - Classes Part 1: Using Them


basics100.png

2 - Classes Part 2: Making Them

With learning about the basics of classes in the previous tutorial, this one will show us how to actually make our own classes.
2 - Classes Part 2: Making Them


basics100.png

3 - Properties

This tutorial covers properties, which are a very cool and conventient feature of C# that makes it easy to get and set the values of instance variables. Properties are one of the big features that sets it apart from other languages, like C++ and Java, which do not (yet) provide them.
3 - Properties


basics100.png

4 - Structs

Now that we know about making classes, we'll take a quick look at a feature that appears similar to classes, at a first glance, but behind the scenes is actually quite different: the struct.
4 - Structs


basics100.png

5 - Inheritance

As we continue to learn about object oriented programming, we'll look into a powerful technique for reusing code and expanding on an existing class, using a feature called inheritance. This tutorial will also introduce the protected access modifier.
5 - Inheritance


basics100.png

6 - Polymorphism, Virtual Methods, and Abstract Base Classes

Our adventure in object oriented programming continues, as we discuss polymorphism, a way to allow derived classes to implement a method in different ways, creating virtual methods and overriding them, and creating abstract base classes and abstract methods.
6 - Polymorphism, Virtual Methods, and Abstract Base Classes


basics100.png

7 - Interfaces

Interfaces are similar to the abstract base classes that we discussed in the previous tutorial. Here we'll look at interfaces, which provide simply a list of methods and properties that a class that uses it must implement, and explains the concept of multiple inheritance, why C# doesn't support it, and how to use interfaces to get a similar result. This tutorial will conclude our discussion on object oriented programming.
7 - Interfaces


basics100.png

8 - Using Generics

Generics provide a way for us to create container classes (or other classes) that can be used for any different type. This tutorial is one of the more important ones, so don't skip it! We'll take a look at the motivation behind generics, and then we'll look at the very useful List and Dictionary classes. The next tutorial will cover how to make your own classes use generics.
8 - Using Generics


basics100.png

9 - Generics

In the previous tutorial, we looked at how to use classes that use generics. In this tutorial, we'll go into the simple details of how to actually create a class that uses generics.
9 - Generics