In an attempt to fully understand how to solve Java's multiple inheritance problems I have a classic question I need clarified.
Lets say I have class Animal
from there it extends bird
and horse
and I need to make a class Pegasus
that extends from bird
and horse
since Pegasus
is a bird and horse.
I think this is the classic diamond problem from what I can understand the classic way to solve this is to make the animal, bird and horse classes interfaces and implement Pegasus from them.
I was wondering if there was another way to solve the problem in which I can still create a objects of birds and horses. If there was a way to be able to create animals also that would be great but not necessary.
Didn't expect to get so many great responses so quickly...thank to every ones help I think I have a better understanding of how to manipulate Java in the way I need. Thank You!!!!!
public class Pegasus extends Horse implements Flying
. – Boris the Spider Feb 17 at 11:54