Saturday, February 19, 2022

Object Oriented Programming

 Advantages of OOP :

  • Reusability
  • OOPs is very helpful in solving very complex level of problems.
  • Highly complex programs can be created, handled, and maintained easily using object-oriented programming.
  • OOPs, promote code reuse, thereby reducing redundancy.
  • OOPs also helps to hide the unnecessary details with the help of Data Abstraction.
  • OOPs, are based on a bottom-up approach, unlike the Structural programming paradigm, which uses a top-down approach.
  • Polymorphism offers a lot of flexibility in OOPs.

Properties of OOP :

  • Encapsulation
  • Data abstraction
  • Polymorphism 
  • Inheritance 

Encapsulation vs Data Abstraction

Encapsulation is the packing of "data" and "functions operating on that data" into a single component and restricting the access to some of the object's components. Encapsulation means that the internal representation of an object is generally hidden from view outside of the object's definition.

Abstraction is a mechanism which represent the essential features without including implementation details.

Encapsulation:-- Information hiding.
Abstraction:-- Implementation hiding.


Polymorphism 

Polymorphism is composed of two words - “poly” which means “many”, and “morph” which means “shapes”. Therefore Polymorphism refers to something that has many shapes.

Types of Polymorphism 




Compile time polymorphism : method overloading

Runtime polymorphism : method overriding 


Reference :