Any programming
language to become as object oriented should follow (satisfy) the following
features apart from the Class and Object
- Abstraction
- Encapsulation
- Polymorphism
- Inheritance
1)Abstraction
- It’s a process of Hiding the Implementation but providing the service
- There are two types of abstraction available:
2)Function Abstraction
2) Encapsulation:
It’s
a process Binding the member variable of a class along with member functions
Encapsulation
can be implemented with the help of object and also Access modifiers like
private, public and protected etc
3)Polymorphism:
It’s
a derived from a Greek word, where poly means many morph means Faces /
BehaviorsSame function / operator will show different behavior s when passed different type of values or different number of values.
Types of polymorphism:
There are two types of polymorphism
There are two types of polymorphism
1)Static
Polymorphism / Compile Time polymorphism / Early Binding
2)Dynamic
Polymorphism / Run Time polymorphism / Late Binding
Static
polymorphism is achieved using i)
Function Overloading ii) Operator
Overloading
Dynamic
polymorphism is achieved by using
i)Function Overriding
4) Inheritance:
- This is a process of creating a new class from already existing class
- In inheritance process existing class is known as Parent / Base class, newly created class is known as Derived / Child class
- In inheritance process, child class will get all the features of parent / base class
- Main purpose of inheritance is code Re-usability and providing additional functionality / enhancement
- Single Inheritance
- Multiple Inheritance
- Multilevel Inheritance
- Hybrid Inheritance
- Hierarchical Inheritance
1.Single Inheritance: Creating a
single new class from single base class is known as single Inheritance
2.Multiple Inheritance: Creating a new
class from two or more base classes is known as Multiple Inheritance
3Multi Level Inheritance: Creating a new
class from already derived class is known as Multi Level Inheritance
4.Hybrid Inheritance: This is
combination of both Multiple and Multi Level Inheritance
5.Hierarchical Inheritance:-Creating
two or more classes from a single base class is known as Hierarchical
inheritance.
No comments:
Post a Comment