Object-Oriented Programming (CS F213) : BITS Pilani
Object-Oriented Programming (CS F213) : BITS Pilani
Inheritance
Inheritance Examples
Java Support for Inheritance [Just
Introduction]
Types of Inheritance
class A
{
A .
}// End of class A
class B extends A
B
{
..
}// End of class B
X class A extends X
{
..
}// End of class A
A B C class B extends X
{
..
}// End of class B
class C extends X
{
..
}// End of class C
8 Object-Oriented Programming (CS F213) Dr. Pankaj Vyas
Types of Inheritance : Hierarchical
class B extends A
{
..
B }// End of class B
class C extends B
{
C ..
}// End of class C
Multiple Inheritance
A B Not Supported in
Java Directly
class A
{
.
} // End of class A
class B
{
.
C }// End of class B
class C extends A, B Wrong
{
. Not Allowed in
} // End of class C
Java
12 Object-Oriented Programming (CS F213) Dr. Pankaj Vyas
Thank You