http://www.codeguru.com/cpp/cpp/cpp_mfc/oop/article.php/c9989
By its nature interface brings multi-inheritance and it can cause "diamond problem".
In order to solve this problem you have to make sure the "implements" always use "public virtual" rather than just "public". See virtual inheritance.
My implementation is here:
#define IMPLEMENTS( INTERFACE_CLASS_NAME ) public virtual INTERFACE_CLASS_NAMEThe virtual destructor problem is less important because compiler will notice the programmer when a class has some virtual method without a virtual destructor.
#define EXTENDS_INTERFACE( INTERFACE_CLASS_NAME ) public virtual INTERFACE_CLASS_NAME
No comments:
Post a Comment