Java and multiple inheritance

50 %
50 %
Information about Java and multiple inheritance
Education

Published on January 19, 2018

Author: anudeep00

Source: authorstream.com

PowerPoint 演示文稿: Java & Inheritance Why Java does'nt support Multiple Inheritance PowerPoint 演示文稿: 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{ C lass C1 extends P2{ ................ ....................... } } PowerPoint 演示文稿: sample code for demonstration PowerPoint 演示文稿: 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 PowerPoint 演示文稿: Case2:Multiple 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 PowerPoint 演示文稿: 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. PowerPoint 演示文稿: With Global Authorization PowerPoint 演示文稿: THANK YOU

Add a comment

Related presentations