Inheritance and Casting
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
Suppose I have the following class:
class C : public A, public B
{
}Assuming that class
B
is a pure virtual class, should I be able to cast objects of typeC
toB
in order to callC's
implementations ofB's
abstract methods? In other words, can I do:C* obj = new C();
DWORD z = ((B*)obj)->GetValue();What I want to do is effectively add my own custom interface to existing MFC classes and then use those objects generically.
The difficult we do right away... ...the impossible takes slightly longer.