Object Oriented Programming (OOP) involves defining classes and creating objects that resemble real life objects. For example, consider a car. The car has properties such as color, speed, model, manufacturer and many more. It also has behaviors or actions such as accelerate, steer left, steer right, and brake. Objects in C# mimics a real life object so a Car object in C# can have the same properties and behaviors of the real one.
OOP deals with classes and objects to modularize codes and make them more manageable. It also promotes software reusability. We first need to define a class which serves as a blueprint for the object we are creating. The object in OOP is the one that is created using the class you defined. For example, consider the class as the blueprint of your house. The blueprint defines properties of the house such as the area, the height, and materials to be used to build the house. The object is the actual house itself which was based on the blueprint.
Object Oriented Programming is the modern approach used by programmers and it makes the program more reusable, readable, and easy to debug. C# is an object-oriented language and everything in C# is an object. The following lessons will show you how you can define classes and use objects. We’ll also take a look at inheritance and polymorphism which are two main concepts studied in object-oriented programming.