How can we achieve Multiple Inheritance in Java ?

Discussion in 'Object Oriented Concepts' started by vbraojava, Sep 15, 2008.

  1. vbraojava

    vbraojava New Member

    Directly we can't achieve Multiple Inheritance in Java.

    Indirectly there are two ways, those are :

    1. We can achieve Multiple Inheritance by implementing more than one Interfaces, because we can have chance to implement more than one Interfaces in Java.

    2. Another indirect way to achieve Multiple Inheritance is, doing by repeated use of Single Inheritance.

    Example
    : Class z extends A,B --- Inavallid (bcz direct way)

    Class B extends A
    } ---- those are vallid (bcz indirect way)
    Class Z extends B

    So, here Class z can have all the features of Class B and Class A, but here we are doing indirect way with the help of Single Inheritance.
     
  2. anneroberts

    anneroberts Member

    Java permits numerous Legacy from claiming interface, Anyway best solitary Legacy for usage. Just Toward the way, those motivation behind the reason java doesn't actualize all the full numerous Legacy may be On account it makes ambiguities. Suppose you Might say "A extends B, C", et cetera both b and c need An work "void f(int)".
     

Share This Page