Pete Becker <pe********@acm.org> wrote:
John wrote:
class Base1
{
virtual void action() = 0;
};
class Base2
{
virtual void action() = 0;
};
class Derived : public Base1, public Base2
{
void action() { /* do stuff */; }
};
Of course, this implies that the specification for both 'action()' methods
is identical or at least similar. This is not necessarily a given (although,
admittedly, likely for a function returning nothing and taking no parameter).
If both bases have different requirements on the implementation of the
function and/or a different return type, you have to use two auxiliary base
classes, each implementing one of the functions. I don't think that C++ has
a mechanism like e.g. C# which allows specification of the base class when
overriding a virtual function.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting