K
Kevin L
Below is a code snippet that fails to compile under vc.net
class BaseInterface
{
public:
virtual void f() = 0;
};
class BaseImplementation : public BaseInterface
{
public:
void f(){}
};
class ExtraInterface : public BaseInterface
{
virtual void g() = 0;
};
class ExtraImplementation: public BaseImplementation, public
ExtraInterface
{
void g(){}
};
void func()
{
ExtraImplementation d;
}
The compiler complains that ExtraImplementation is an abstract class
and therefore cannot be initialized. Function f, despite being
defined in BaseImplementation, is undefined in ExtraImplementation.
I hope it's clear what I'm trying to do, i.e., maintaining two
inheritance lines that parallel each other. One line consists of
interfaces and the other implementation. Am I misguided in my
efforts?
Kevin
class BaseInterface
{
public:
virtual void f() = 0;
};
class BaseImplementation : public BaseInterface
{
public:
void f(){}
};
class ExtraInterface : public BaseInterface
{
virtual void g() = 0;
};
class ExtraImplementation: public BaseImplementation, public
ExtraInterface
{
void g(){}
};
void func()
{
ExtraImplementation d;
}
The compiler complains that ExtraImplementation is an abstract class
and therefore cannot be initialized. Function f, despite being
defined in BaseImplementation, is undefined in ExtraImplementation.
I hope it's clear what I'm trying to do, i.e., maintaining two
inheritance lines that parallel each other. One line consists of
interfaces and the other implementation. Am I misguided in my
efforts?
Kevin