Java multiple inheritance?

Post your Java discussions here
Post Reply
Posts: 0
Joined: Fri Jun 03, 2016 10:17 am

Java multiple inheritance?

Post by 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

Site Admin
Site Admin
Posts: 3760
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Java multiple inheritance?

Post by 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 Support Manager

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

Re: Java multiple inheritance?

Post by 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 {}


Post Reply