Inheritance:
Inheritance is a process of acquiring of the properties from
one class to another class that is creating a new class by deriving properties
from existing class.
Advantage :
we can reuse one class methods and variables without creating same methods and variable again and again. By doing like this we decrease length of program very easily.
We are creating a child class by inheriting the parent class
properties, and we can also add some features to child class.
Parent Class :
The
base class which is already created and gives its properties to derived class
is known parent class or base class or super class.
Child Class :
The derived class which is takes the
properties form already exists base class is known as Child class or derived
class or sub class.
In OOP System there are five types of Inheritance are
available . they are
- Single Inheritance
- Hierarchical Inheritance
- Multi Level Inheritance
- Multiple Inheritance
- Hybrid Inheritance
Single Inheritance:
Creating one new class by deriving properties that is
methods and variables from single base class.
It is a simple type of inheritance.
Hierarchical
Inheritance:
Creating two or more sub classes from single base class is
known as Hierarchical Inheritance.
Multi level
Inheritance:
Creating a sub class from already derived class is known as
Multi Level Inheritance.
Multiple Inheritance:
Creating a new class by deriving from two or more class is
known as Multiple inheritance.
Hybrid Inheritance:
It is combination of any two type of Multi level inheritance,Hierarchical inheritance and Multiple
Inheritance, It is rare type of inheritance used in practical.
Note: Other OOP languages like C++ support multiple inheritance and hybrid inheritance. But C# and VB.NET doesn‘t support multiple inheritance and hybrid inheritance to avoid some practical problems while developing future GUI applications like windows forms applications, web sites etc.
--------------------------------------------------------------------------------------------------------------------------
Very informative ..i suggest this blog to my friends..Thank you for sharingjava training in chennai | chennai's no.1 java training in chennai | best java institute in chennai
ReplyDeleteGood Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeletec net training in electronic city