Test and Measurement Forum

Java multiple inheritance?

Post your Java discussions here

Java multiple inheritance?

Postby kokilasoral » Fri Jun 03, 2016 12:51 pm

Hi, everyone
C++ is my 1st language but I now I want to learn Java.
C++ accepts multiple inheritance.
Class d
Protected class q(), class w()
But Java doesn't accept multiple inheritance.
Java use interfaces to contrivance multiple inheritance.
how to use interface to achieve multiple inheritance.
Thank you
Posts: 0
Joined: Fri Jun 03, 2016 10:17 am

Re: Java multiple inheritance?

Postby Martyn » Sat Jun 04, 2016 9:08 am

Have you used C++ to control our scopes, and are now looking to try and do the same with Java ?
Technical Specialist
Site Admin
Site Admin
Posts: 2314
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Java multiple inheritance?

Postby Sanjay » Thu Aug 25, 2016 6:56 am

Multiple inheritance:
Code: Select all
public class Example {
   public interface Animal {}
   public interface FourLegs {}
   public interface EightLegs {}
   public class Insect {}

   public abstract class Spider extends Insect implements Animal, EightLegs {}
   public class Pegasus implements Animal, FourLegs {}

Posts: 6
Joined: Mon Jun 20, 2016 1:08 pm

Return to Java

Who is online

Users browsing this forum: No registered users and 0 guests