I have 3 classes. class A, class B, and class C, class D, defined in 4 files A.cpp, B.cpp, C.cpp, D.cpp
inheritence hierarchy is as follows.
A--> B --> C
|
|
V
D
i.e, A is inherited by B which is inherited by C and D.
then, A and B has a virtual function test() overridden in C and D.
and I need to use dynamic binding as follows..
Expand|Select|Wrap|Line Numbers
- //this would be a member function of A
- bool A::SomeFunc()
- {
- A * var;
- if(some condition)
- var = new C();
- else
- var = new D();
- ..
- ..
- ..
- return TRUE;
- }
A needs C and D.
C and D needs B.
and B needs A.
so there is a circular inclusion.
becuase of which base classes inherited are not recognised.
can anybody suggest a solution? is this a common problem?
waiting for your reply,
Xoinki