Object-Oriented Programming (OOPs) Concepts
- Object
- Class
- Inheritance
- Polymorphism
- Abstraction
- Encapsulation
Object
Any entity that has state and behavior is known as an object. For example: table, keyboard, car etc. It can be physical and logical.Class
A class is a blueprint or prototype from which objects are created. Class is a collection of objects is called class. It is a logical entity.Inheritance
When one object acquires all the properties and behaviours of parent object i.e. known as inheritance. It provides code re-usability. It is used to achieve runtime polymorphism.Polymorphism
When one task is performed by different ways i.e. known as polymorphism. In java, we use method overloading and method overriding to achieve polymorphism.For example: to draw something e.g. shape or rectangle etc.
Abstraction
Hiding internal details and showing functionality is known as abstraction. For example: Driver don't wanna know how car internally works.In java, we use abstract class and interface to achieve abstraction.
0 comments:
Post a Comment