Object Oriented Programming (OOP) concepts in .Net

SharePoint deveopment training course

In this article we will discuss about OOPs concept in .Net. Mainly there are 3 things in OOPs concept.

1- Inheritance
2- Abstraction
3- Polimorphism

1- Inheritance:
Inheritance is one of the key feature of oops concept and C# supports inheritance. Inheritance is a process of deriving the new class from already existing class. It allows you to reuse existing code.

A color (:) symbol is used for inheritance like below:
class ChildClass: ParentClass
Note: In .Net every class is inherit from the System.object class

There are different types of inheritance available in C#.Net like below:

– Single Inheritance
When a single derived class is created from a single base class then the inheritance is called as single inheritance.

– Hierarchical Inheritance
When more than one derived class are created from a single base class, then that inheritance is called as hierarchical inheritance.

– Multi Level Inheritance
When a derived class is created from another derived class, then that inheritance is called as multi level inheritance.

– Hybrid Inheritance
Any combination of single, hierarchical and multi level inheritances is called as hybrid inheritance.

– Multiple Inheritance
When a derived class is created from more than one base class then that inheritance is called as multiple inheritance. But multiple inheritance is not supported by .net using classes and can be done using interfaces.

2- Abstraction:
Abstraction is a process of hiding the implementation details and displaying the essential features.

For Abstraction .net provides different access specifiers like below:
Public: Accessible outside the class through object reference.

Private: Accessible inside the class only through member functions.

Protected: Just like private but Accessible in derived classes also through member functions.

Internal: Visible inside the assembly. Accessible through objects.

Protected Internal: Visible inside the assembly through objects and in derived classes outside the assembly through member functions.

3. Polymorphism:

Polymorphism means having more than one form. In C#.Net Overloading and overriding are used to implement polymorphism.

Polymorphism is classified into compile time polymorphism or early binding or static binding and Runtime polymorphism or late binding or dynamic binding.

Compile time Polymorphism or Early Binding:

The polymorphism in which compiler identifies which polymorphic form it has to execute at compile time it self is called as compile time polymorphism or early binding.

Runtime Polymorphism or Late Binding:

The polymorphism in which compiler identifies which polymorphic form to execute at runtime but not at compile time is called as runtime polymorphism or late binding.

Overloading Example:

class MethoOverLoadingDemo

public int Sum (int X, int Y)
return X + Y;

public float Sum(int X, float Y)
return X + Y;

Here Sum method has been overloaded.

Overriding Example:

class BaseClass
public virtual string Hell0()
return “Hello !!!”;

class DerivedClass : BaseClass
public override string Hell0()
return “Hello !!! Welcome to AspDotNetHelp.com”;

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)


About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →