What is inheritance? Also defines the types of inheritance. code example
Example 1: types of inheritance
OOPs support the six different types of inheritance as given below :
Single inheritance.
Multi-level inheritance.
Multiple inheritance.
Multipath inheritance.
Hierarchical Inheritance.
Hybrid Inheritance.
Example 2: types of inheritance
//Base Class
class A
{
public void fooA()
{
//TO DO:
}
}
//Base Class
class B
{
public void fooB()
{
//TO DO:
}
}
//Derived Class
class C : A, B
{
public void fooC()
{
//TO DO:
}
}