C# FAQ 1 - What Is Object Oriented Programming?

What is Object Oriented Programming

We deal with objects every day. There are basically two kinds of objects namely objects with life and without life. Animals and human beings form living objects whereas Buildings and Furniture are objects without life. Each of these objects include certain properties and you can also perform certain actions which ultimately describes their behavior.

Object Oriented Programming (OOP) mainly involves representing objects in a programming language and using them appropriately.

Before learning more about objects you should be aware about the concept of classes. A class represents group of objects of similar kind. Moreover, a class is considered as a template for creating multiple objects with similar features.

For example, you can define Display, RAM, Memory and Software in a class called Smartphone. Here each of the computer spares are called as objects. Therefore, you can say that an object is an instance (copy) of a class. In the above case, Display and RAM are an instance of the class Smartphone and hence they are termed as objects.

All Object Oriented languages shares common set of features such as Encapsulation, Inheritance and Polymorphism. An object oriented programming language code contains a class definition and its related objects. Hence, they are packaged into some sort of theme and this process is termed as Encapsulation. On the other hand, Inheritance is reusing of the features of one class in another class without defining them. So if you are building applications with large amount of code, you can apply this functionality so that you need not rewrite the whole code from scratch.

Polymorphism, also called as Overloading, means defining different versions of the same code in various versions. The relevant code snippet will be enclosed inside a method. For instance, Addition involves adding of 2 numbers, 3 numbers and so on. Here you are declaring one common situation in different ways.

Since C# is an Object Oriented Programming language, it provides support for all the above features and hence you can apply them while developing C# applications.

The upcoming FAQs will discuss the various aspects of C# including Visual C#.