tags:

views:

11

answers:

0

Hi

Recently we have encountered the following situation. We had a class hierarchy,

        Base
          |
       Derived1

And we had a interface as

interface I1
{
void method1(Derived1& ob);
void method2(Derived1& ob);
void id(string ob);
};

Now we have introduced another derived class to this.

    Base
      |
 -------------
 |           | 
Derived1  Derived2

Now we have to provide another interface for Dervied2 and also any implementation should not need a rebuild for existing customer implementations. Only those who like to use derived2 should be in need of interface.

There was a proposal, another interfaced i2 deriving from i1, accepting Dervied2

interface i2 : i1
{
void method3(Dervied3 &ob);
void method4(Dervied4 &ob);
}

also one more proposal

interface i2: i1
{
void method3(Base &ob);
void method4(Base &ob);
}

The above interface inheritance is a complete reverse of the class hierarchy?

I don't think the 2nd proposal is right. Is this acceptable?