Overview Of OOPS

In early years there was linear programming and procedure oriented programming. In Procedure Oriented Programming, member variable and method of class execute separately, so execution process of procedure oriented programming was slow. And a big drawback with procedure oriented programming was we cannot reuse the code which has executed once. Suppose there is one class Student as in the following code snippet:

  1. Class Student  
  2. Int Sid;  
  3. String Sname, Sadress;  
  4. Public void Get() 
  5. {  
  6.     Console.Write(“Enter the Student Id, Name and Address”);  
  7.     Sid = convert.ToInt32(Console.ReadLine());  
  8.     Sname = Console.ReadLine();  
  9.     Sadress = Console.ReadLine();  
  10. }  
  11. Public void Display() 
  12. {  
  13.     Console.WriteLine(“Student Id is: ”this.Sid);  
  14.     Console.WriteLine(“Student Name is: ”this.Sname);  
  15.     Console.WriteLine(“Student Address is: ”this.Sadress);  
  16. }  
  17. }  
  18. Class Details  
  19. Public void Main(); {  
  20.     Student obj = new Student();  
  21.     Obj.get;  
  22.     Obj.Display();  
  23. }  
  24. Console.ReadLine();  
  25. }  
  26. }  
In this Class if we required displaying the detail of course together with Student, then we required to write the Program for Class Student once again along with Course Class. So it was a waste of resources, since developer has developed Object Oriented programming language that consider each and everything as Entity.

Oop provide reusability of code in object oriented programming language member variable and method execute together so the code execution in .NET is faster than procedure oriented programming language code.

Properties

Properties of object oriented programming language are:
  • Inheritance
  • Encapsulation
  • Polymorphism
  • Abstraction

The Properties of OOP shown graphically in the following figure.

OOP Properties
Figure: OOP Properties

Inheritance

Inheritance is a process of deriving new class from the  class which already exists.. There are five types of Inheritance:

  • Single Inheritance
  • Multilevel Inheritance
  • Multiple Inheritances
  • Hybrid Inheritance
  • Hierarchical Inheritance

Polymorphism

Polymorphism means “Many forms”, When one method behaves in different forms it is known as Polymorphism. Also, new implementation of same method with different signature is known as Function Overloading. There are the following two types of Polymorphism.

  • Static Polymorphism
  • Dynamic Polymorphism

Encapsulation

Encapsulation is a process of binding member variable and method of a class together. In object oriented programming language member variable and method of a class execute together, so code execution in object oriented programming language code is faster than procedure oriented programming language code.

Abstraction

Hiding the implementation and providing services to user is known as Abstraction.

Recap

Object oriented programming language provides the reusability of code and the execution of object oriented programming language code is faster than procedure oriented programming language code.

The properties of Object oriented programming Language are the following:

  • Inheritance
  • Encapsulation
  • Polymorphism
  • Abstraction

Up Next
    Ebook Download
    View all
    OOP/OOD
    Read by 0 people
    Download Now!
    Learn
    View all