OOPS Concepts
OPPS is basically a concept which is related to the real world.
Some basic OOPs concepts are as follows:
- Class
- Object
- Data Hiding
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
Class: Class is a group of objects.
Ex: Class
Object: Object is a real World entity.
Ex: Car, TV, Book, etc.
Data Hiding: Data hiding is the concept of hiding data from the unauthorised person/user.
Ex: mail, Bank account.
Abstraction: Abstraction is the concept of showing only essential information to the user and hiding some data from the user.
Ex: ATM Machine.
Encapsulation: Encapsulation is the concept of wrapping-up of data and it's corresponding behaviour into a single unit.
Encapsulation=Data Hiding + Encapsulation
Ex: POJO Class.
Inheritance: Inheritance is the concept of parent child relationship, where the child class adopt the feature of the parent class. The parent class is also known as Base class and the child class is known as Derived class.
Ex: parent and child.
Inheritance are of 5 types:
- Single level inheritance.
- Multilevel Inheritance
- Multiple Inheritance
- Hierarchical Inheritance
- Hybrid Inheritance
Single Level Inheritance:
Where there is only one Base class and one Derived class.
Multilevel Inheritance:
Where base class inherit it's parent class.
Multiple Inheritance:
Where one Derived class can inherit multiple base class .
Hierarchical Inheritance:
Where we have one base class and multiple derived class.
Hybrid Inheritance:
Where one derived class inherit two base classes.
Polymorphism: Polymorphism is the a Greek world, where "Poly" means " one thing" and "Morphism" means "Many Forms".
In OOP we have two types of Polymorphism:
1. Static Polymorphism
2. Dynamic Polymorphism
In OOP we have two types of Polymorphism:
1. Static Polymorphism
2. Dynamic Polymorphism
No comments:
Post a Comment