Why java does'nt support multiple inheritance - PowerPoint PPT Presentation

About This Presentation
Title:

Why java does'nt support multiple inheritance

Description:

This ppt shows us Why java does'nt support multiple inheritance – PowerPoint PPT presentation

Number of Views:82

less

Transcript and Presenter's Notes

Title: Why java does'nt support multiple inheritance


1
Java Inheritance
  • Why Java does'nt support Multiple Inheritance

2
  • If there are two parent classes let them be P1
    and P2 ad a Child class C1
    Class P1
    Class P2
  • ..............
    ..............


    Now for assumption,C1 is a child of both P1
    and P2 Class C1 extends P1
    Class C1 extends P2
  • ................
    .......................


3
(No Transcript)
4
sample code for demonstration
5
  • Now if m1() method were to be called from Child
    class , confusion occurs leading to ambiguity as
    to consider which m1,whether from P1 class or
    from P2 class
  • Hence java does'nt support multiple inheritance
    with respect to class
  • Conclusion Multiple Inheritance is not supported
    with respect to Classes

6
Case2Multiple Inheritance is supported
with respect to Interfaces
  • But in case of interfaces it supports multiple
    inheritance with same P1 ad P2 as parent
    interfaces and C1 as child interfaces,C1 can
    inherit the P1 and P2.
  • Here ambiguity does'nt occur as Interface
    contains only declaration and don't deal with
    implementation
  • Get to know more about oops by java
    training

7
Java Training by Besant technologies
  • This program does not have any pre-requisites
    that you need to have. Even if you are new to the
    Programming environment, trainers at Besant
    Technologies will create a platform wherein, you
    can enjoy building your developing skills.

8
With Global Authorization
9
  • THANK YOU
Write a Comment
User Comments (0)
About PowerShow.com