Abstraction
Showing only the information which is enough for the end user an hiding the implementation part.
For eg. -> Calling the sort function on an array.
The user knows the end point sort but doesn't know how it actually works.
Encapsulation
Binding the data objects and variables with their implementation.
For Eg. -> When we use an object (in js) and define a function that uses it we are trying to bind this function with that particular data which it is defined in.
Inheritance
Re-using an existing code and re-tweaking it to modify or add different features to make it more specialized .
For eg -> A child object inheriting for a parent object.
Polymorphism
Poly -> many morph -> forms
Means taking many forms that is a particular method taking different forms in different contexts which is used when a child inherits form a parent and it wants to modify a current functionality of the parent -> it uses polymorphism to override it.
Top comments (0)