Re: I wish c++ did interfaces better.
"James Kanze" <james.kanze@gmail.com> wrote in message =
news:6fef25cf-b57f-4643-a672-43b4f7192169@59g2000hsb.googlegroups.com...
But you didn't define better. And the problems you describe
sound more like problems specific to COM (which isn't C++) or to
Microsoft's implementation, or to both. At least, I've never
been affected by them (but of course, for interlanguage
communication, I use Corba, since COM isn't really very well
supported once you leave the Windows world).
Leaving the actual layout of vtables up to the compiler vendors - I mean =
a compiler vendor targetting a COM compatible platform would, perforce, =
ensure that basic vtables are layed out in the expected / required =
binary fashion...
I would wish that c++ made my life easier by providing some way for me =
to say, "Yes, I know Ive inherited from that struct of virtual methods =
several times, but I have also inherited an implementation - it might be =
further away inheritance wise, but use it anyway". Which is to say, I =
want a non clumsy way to do the following
1. declare an interface (IA), declare an interface that extends the =
first interface (IB) - and to be COM complaint the IB -> IA relationship =
cannot be virtual.
2. And then declare a class A that implements IA, as well as
3. a class B, that inherits the IA implementation as well as =
implementing IB. Step 3 is the problem.
struct IA {
virtual method1()=0;
};
struct IB : IA {
virtual method2()=0;
};
class A: IA {
method1(){}
};
class B:A,IB {
method2(){}
};