S
Shawn Casey
Consider the following code:
interface IBase
{
virtual void BaseFunction() = 0;
};
interface IDerived : public IBase
{
virtual void DerivedFunction() = 0;
};
class cBase : public IBase
{
public:
void BaseFunction { ... }
};
class cDerived : public IDerived, cBase
{
public:
void DerivedFunction { ... }
};
I want the IDerived interface to have both DerivedFunction() and
BaseFunction() abilities without the implementation repeating the IBase
function implementations.
It seems to me that the pure interfaces require implemenations and both
classes satisfy that requirement (cDerived inheriting from cBase to get the
BaseFunction implementation), but the compiler complains that cDerived can't
be instantiated because IBase::BaseFunction() is an undefined pure virtual
function.
If you couldn't guess, this is for COM which requires the interfaces to have
pure virtual functions.
What gives? Surely it's something simple I'm overlooking...
interface IBase
{
virtual void BaseFunction() = 0;
};
interface IDerived : public IBase
{
virtual void DerivedFunction() = 0;
};
class cBase : public IBase
{
public:
void BaseFunction { ... }
};
class cDerived : public IDerived, cBase
{
public:
void DerivedFunction { ... }
};
I want the IDerived interface to have both DerivedFunction() and
BaseFunction() abilities without the implementation repeating the IBase
function implementations.
It seems to me that the pure interfaces require implemenations and both
classes satisfy that requirement (cDerived inheriting from cBase to get the
BaseFunction implementation), but the compiler complains that cDerived can't
be instantiated because IBase::BaseFunction() is an undefined pure virtual
function.
If you couldn't guess, this is for COM which requires the interfaces to have
pure virtual functions.
What gives? Surely it's something simple I'm overlooking...