• Advertisement

Archived

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

More virtual base class fun

This topic is 5240 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Guest Anonymous Poster
IMO, haing a virtual abstract base type doesn''t make much sense

Share this post


Link to post
Share on other sites
virtual abstract base types are pretty much only useful for interfaces.

Share this post


Link to post
Share on other sites

  • Advertisement