filmov
tv
#50 Multiple Inheritance in Java
Показать описание
Check out our courses:
Coupon: TELUSKO10 (10% Discount)
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
For More Queries WhatsApp or Call on : +919008963671
In this lecture we are discussing:
1)what is multiple inheritance?
2)Why Java does not support Multiple Inheritance?
3)What is ambiguity and not allowed in java?
#1
Multiple inheritance
If a particular class inheriting multiple class then this type of inheritance is called multiple inheritance.
like c++ language there are multiple inheritance like that :
class A
{
... .. ...
};
class B
{
... .. ...
};
class C: public A,public B
{
... ... ...
};
But Java not allowed we have alternate option for that is implementing multiple interface not we will discussing in upcoming lecture.
#2
why java not support multiple inheritance?
=Because of the Ambiguity problem, Java does not support multiple inheritances directly.
#3
Why it is ambiguous?
suppose we have some class A, B and c
class A
{
... .. ...
show(){
}
};
class B
{
... .. ...
show(){
}
};
class C extends A,B //assume for some instance java support multiple inheritence
{
... ... ...
show();
//here we get ambiguity since if we allowed multiple inheritance and same two property or method belong to class A and Class B
//then how C class use show() method there is ambiguity of choice...
//that’s why java exclude the concept of multiple inheritance
};
More Learning :
Donation:
PayPal Id : navinreddy20
Coupon: TELUSKO10 (10% Discount)
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
For More Queries WhatsApp or Call on : +919008963671
In this lecture we are discussing:
1)what is multiple inheritance?
2)Why Java does not support Multiple Inheritance?
3)What is ambiguity and not allowed in java?
#1
Multiple inheritance
If a particular class inheriting multiple class then this type of inheritance is called multiple inheritance.
like c++ language there are multiple inheritance like that :
class A
{
... .. ...
};
class B
{
... .. ...
};
class C: public A,public B
{
... ... ...
};
But Java not allowed we have alternate option for that is implementing multiple interface not we will discussing in upcoming lecture.
#2
why java not support multiple inheritance?
=Because of the Ambiguity problem, Java does not support multiple inheritances directly.
#3
Why it is ambiguous?
suppose we have some class A, B and c
class A
{
... .. ...
show(){
}
};
class B
{
... .. ...
show(){
}
};
class C extends A,B //assume for some instance java support multiple inheritence
{
... ... ...
show();
//here we get ambiguity since if we allowed multiple inheritance and same two property or method belong to class A and Class B
//then how C class use show() method there is ambiguity of choice...
//that’s why java exclude the concept of multiple inheritance
};
More Learning :
Donation:
PayPal Id : navinreddy20
Комментарии