2009-11-20, 09:45 PM
My python is a little rusty, as I haven't used it in years, but the basic concept is the same in C++ or C#. An abstract base class is the same as a base class except that it Must be derived from. (As in you can't create an instance of the abstract class.)
Some sample code in C++ would be:
class Bar
{
Bar(){}
virtual ~Bar(){}
virtual void GetName() = 0;
};
class Foo : public Bar
{
Foo(){}
virtual ~Foo(){}
//Must overwite GetName()
void GetName();
};
In practice it is good to use abstract inheritance when you don't want someone to create an instance of the base class, however since I am assumeing that you are writeing the code for your own personal use, it really doesn't matter.
Some sample code in C++ would be:
class Bar
{
Bar(){}
virtual ~Bar(){}
virtual void GetName() = 0;
};
class Foo : public Bar
{
Foo(){}
virtual ~Foo(){}
//Must overwite GetName()
void GetName();
};
In practice it is good to use abstract inheritance when you don't want someone to create an instance of the base class, however since I am assumeing that you are writeing the code for your own personal use, it really doesn't matter.

