Another interface bug -- double inheritance of same

Bill Baxter dnewsgroup at billbaxter.com
Sun Apr 22 21:27:34 PDT 2007


Different from the last one.
"Double declaring" an interface seems to cause it to ignore the fact 
that a base class implements the interface.

interface Fruit
{
    ...  // some methods
}
interface Vehicle
{
    void drive_around();
    ...  // some other methods
}
interface MobileFruit : Fruit, Vehicle
{
    // nothing here, should inherit from superinterfaces
}

class BaseFruit : Fruit
{
    // implement (some of) Fruit's methods here
}

class MobileFruitGundam : BaseFruit, MobileFruit, Fruit
{
    // implement what's not in BaseFruit already
    ...
}

This complains that MobileFruitGundam doesn't implement Fruit's methods, 
even though they're implemented by BaseFruit.

It's not a huge problem because I think the result still acts like a 
Fruit even without the extra ",Fruit" there -- so
     Fruit f = new MobileFruitGundam;
is still ok, but I think it is an issue for template code that wants to 
derive from interfaces that are passed in as parameters or deduced from 
template parameters.

Does this sound like a bug too?

--bb


More information about the Digitalmars-d-bugs mailing list