I am working on making something that uses multiple inheritance similar to java's implements with interfaces.
The best I can figure it the only way to do this in C++ is to make a class and make all the functions virtual and use multiple inheritance. Is there a better way to do this?
The best I can figure it the only way to do this in C++ is to make a class and make all the functions virtual and use multiple inheritance. Is there a better way to do this?
Code:
class Interface
{
public:
virtual void InterfaceFunction() = 0;
};
class Base
{
public:
virtual int BaseFunction(){\\Does something}
};
class Derived : public Base, public Interface
{
public:
void InterfaceFunction(){}
int BaseFunction(){ return Base::BaseFunction(); } // Is this needed?
};
Last edited: