oops concepts in c#

Object-oriented programming is a type of methodology in which programs are designed using classes and objects.

In this, all the problems are taken as one unit or object and it becomes very easy to design the program here.

 

Oops, concepts in the C programming language:

 

Class:

A class is a collection of objects. There can be more than one object of the same class.

The behavior of an object, its functionality, how it will work inside its class. All these things are defined.

 

Object:

The object contains data and functions. The object is the variable of the class that executes the class. The object is applied in the real world. An object is an instance of a class.

 

Inheritance:

Inheritance is the most important concept of oops. When a new class is derived from an old class (base class), then that process is called inheritance. The old class is called the base class. And the new class that is created from it is called the derived class.

 

Types of inheritance:

 

1. Single inheritance:

When a new class is derived from the base class, it is called single inheritance.

 

2. Multi-Level Inheritance:

When we derive another new class from a derived class, it is called multi-level inheritance.

 

3. Multiple Inheritance:

multiple inheritances have more than base class and a one derived class from which we call multiple inheritances.

 

4. Hierarchical Inheritance:

Hierarchical inheritance consists of one base class and more than one derived class. So we call it hierarchical inheritance.

 

Encapsulation:

 

Encapsulation is a concept of oops, adding data and functions together, it is called encapsulation.

 

Abstraction:

 

Abstraction means to show the object that is necessary and to hide other things.

In abstraction, users are shown only what they mean, this is called abstraction.

 

Polymorphism:

 

In the concept of oops, polymorphism is made up of two Greek words.

Poly + Morphism = "Polymorphism"

Poly 'means' many and Morphism 'means' Forms.

Combining both words, polymorphism is called many forms.

 

Types of polymorphism:

 

1. Compile-time polymorphism:

 

Compile-time polymorphism means such operations that are taken at compile-time, we call it method overloading or early binding or static polymorphism.

 

2. Run-time polymorphism:

 

Run-time polymorphism is also called dynamic binding. In dynamic binding, the operations we perform are either at run-time or execution time. So it is called late binding or overriding method.



Post a Comment

0 Comments