Dec 12, 2023
It is the process in which one object inherits all the properties and behaviors of other object. The object which inherits the properties and behaviors are called child object and from which object it inherits are called parent object.
The word Polymorphism is comprises of two different words ‘poly’ which means ‘many’ and ‘morphs’ which means ‘form’. Polymorphism is the ability to present same entity with different forms. Eg: A man can be a father, son or husband at the same time.
Abstraction is the process of hiding the implementation details and showing only necessary details to the end user. For example: Google Pay App, the end used don’t need to know the internal implementation how the payment gateway is working.
The process of wrapping up of data and the methods which operate on that data into a single unit is called encapsulation. Eg: Defining a class is also an example of encapsulation, we declare the data and the method which operate on that data.
Classes are user-defined data types which define the object’s properties and functionalities. The classes are the blueprints for creating objects. The class does not occupy any space in the memory until an object of that class is instantiated.
An object is a real-world, run-time entity. It has a state and a behavior. For example, A dog is an object, it has states such as name, color, weight, height etc. and along with this it has behavior such as eat, run, bark etc.