C#.Net OOPS Concepts, Features & Explanation

C#.Net OOPS Concepts, Features & Explanation

Today, We want to share with you C#.Net OOPS Concepts, Features & Explanation.
In this post we will show you Object-Oriented Programming Concepts in C# , hear for Introduction to Object Oriented Programming Concepts in C# we will give you demo and example for implement.
In this post, we will learn about OOPS Concepts, Features & Explanation with Example in C#.Net with an example.

What are the OOPS concepts in c# net?

There are the Following the List of the Object-Oriented Programming Concepts in C#

  • Abstraction.
  • Encapsulation.
  • Inheritance and.
  • Polymorphism.
  • OOPS = Object Oriented Programming.
  • OOPS is a programming technique which provides an efficient way to manage Object and its behaviour across a system.
  • OOPS provides a way to show/hide relevant data.
  • OOPS provides an efficient way for code reusability.

Here I will explain you important concepts of OOPs.

(1) Class

The class can be considered as a blueprint for an object.

A class is a collection of object.

Also Read :  Remove HTML Table Row and Column using jQuery

It is compulsory to create a class for representation of data.

Class do not occupy memory space, so it is a merely logical representation of data.

The syntax for declaring a class.

<pre class="EnlighterJSRAW" data-enlighter-language="csharp">public class College
     //your code goes here.

(2) Object

The object is variable of type Class.

Object possess property and behaviour.

As a class do not occupy any memory, so to work with real-time data representation you need to make an object of the class.


– Here is the syntax to create an object(we just created above).

<pre class="EnlighterJSRAW" data-enlighter-language="csharp">College objCollege = new College();</pre>

(3) Encapsulation

Encapsulation is the process of keeping item into one logical unit.

Encapsulation is a technique used to protect the information in an object from another object.

The concept of data hiding or information hiding can be achieved by encapsulation.

In c#,Encapsulation is implemented using the access modifier keywords. C# provides 5 types of access modifier,

which are listed below.

(i) Public: Public members are accessible by any other code in the same  assembly or another assembly that reference it.

Also Read :  jQuery Ajax Multiple File Upload Using PHP

(ii)Private: Private member can only be accessed by code in the same class.

(iii)Protected: Protected member can only be accessed by code in the same class or in a derived class.

(iv)Internal: Internal member can be accessed by any code in the same assembly, but not from another assembly.

(v) Protected Internal : Protected Internal member can be accessed by any code in the same assembly, or by any derived class in another assembly.

(4) Polymorphism

Polymorphism is an ability to take more than one form in different case/scenario.

It can make different logical units but with the same name. Its behaviour is executed based on input or the way it is called.

<pre class="EnlighterJSRAW" data-enlighter-language="csharp">class PolymorphismExample
     public void Add(int p_Value1, int p_Value2)
         Console.WriteLine("Result ={0}", p_Value1 + p_Value2); // This will perform addition of p_Value1 and p_Value2

      public void Add(string p_Value1, string p_Value2)
          Console.WriteLine("Result ={0}", p_Value1 + p_Value2); // This will perform concatenation of p_Value1 and p_Value2

(5) Inheritance

Also Read :  Google adsense Remove Yellow Background box in wordpress

Inheritance provides a way to inherit member of another class.

It Provides a way to reuse code which is already written.

<pre class="EnlighterJSRAW" data-enlighter-language="csharp">class InheritanceExample
        public abstract class AllCar
            public abstract string GetCarName();
        public class HondaSeries : AllCar
            //this method name matches with same signature/parameters in AllCar class
            public override string GetCarName()
                return "Car Name is Honda City";
        public static void Main(string[] args)
            AllCar objAllCar = new HondaSeries();

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about C#.Net OOPS Concepts, Features & Explanation.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Reply

Notify of