OOPS Concept With Real Time Example

OOPS (object oriented programming language) is a concept and C# supports the OOPS concept. Below are the features

  1. Class and object
  2. Abstraction
  3. Polymorphism
  4. Inheritance
  5. Encapsulation

CLASS and OBJECT

To represent data we need class, and class is the core concept of OOPS. Class is a blueprint of object that contains variables and methods. It is logical representation of data.

 

  1. Class next{}  

 

Here name of the class is next and we did not specify any access modifier. This is the syntax of class.

OBJECT



And the output is today is the best day.

Object is the concept which represents the class. It is the instance of class. With the help of a new operator we may easily create object of class and memory is created in the HEAP and the object is called an instance of class.

REAL TIME EXAMPLE

If animal is the class then dog is the object, if human is the class then man is the object. A dog has legs and eyes, then eyes is the variable in the technical concept,  this is the property and the dog may run or may walk, these are methods, and the same concept we used in OOPS concept.



ABSTRACTION

One of the most important concepts of OOPS is abstraction, to represent the important features without representing the inner concept or details.