why would you do that ??
abstract class is already an abstract class, one I think should be enough because after all it's generic and should contain all functions
multiple inheritance can cause confusion
why would you do that ??
abstract class is already an abstract class, one I think should be enough because after all it's generic and should contain all functions
multiple inheritance can cause confusion
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."-Bjarne Stroustrup
Nearing the end of finishing my 2D card game! I have to work on its 'manifesto' though <_<
Sure it's possible. You might want an abstract subclass to provide a partial default implementation. Even if you don't provide a default impl, you may want to extend the interface.
$ g++ abstract.cppCode:#include <iostream> class A { public: virtual void func1() = 0; virtual void func2() = 0; }; class B : public A { public: virtual void func2() { std::cout << "B::func2()" << std::endl; } }; class C : public B { public: virtual void func1() { std::cout << "C::func1()" << std::endl; } }; int main() { A * c = new C; // Can't do this, because B is abstract // A * b = new B; c->func1(); c->func2(); }
$ a.out
C::func1()
B::func2()
$
Last edited by medievalelks; 06-18-2009 at 08:36 AM.