Archived

This topic is now archived and is closed to further replies.

superpig

More virtual base class fun

Recommended Posts

class IBase
{
 virtual void A()=0;
 virtual void B()=0;
};

class C1 : virtual public IBase
{
 A() { txtOut("C1::A called"); }
 B() { doSomething(); A(); }
};

class IExtendedBase : virtual public IBase
{
 virtual void ExtraOperation()=0;
};

class CExtended1 : public C1, public IExtendedBase
{
 ExtraOperation(){ doSomethingElse(); }
 A() { txtOut("CE1::A called"); }
};

CExtended1 e;
e.B();
Is calling function B() on CExtended1 fully valid like that, and will it go on to call C1::A or CExtended1::A? I think it''ll call CExtended1::A, but I wanted to check. (I''m trying to extend an interface and its implementation, in case you were wondering why the hell I''d ever want to do this). Richard "Superpig" Fine - saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4 ry. .ibu cy. .y''ybu. .abu ry. dy. "sy. .ubu py. .ebu ry. py. .ibu gy." fy. .ibu ny. .ebu OpenGL is a language

Share this post


Link to post
Share on other sites
quote:
Original post by Lektrix
It makes perfect sense.



I honestly don''t think it does either.


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]

Share this post


Link to post
Share on other sites