I need to include a .h file that has already been included in another file. Because I cant include the same .h files in two different classes, I am stuck.
The following is an example of what I mean:
The a.h fileCode:#include "a.h" int main() { AClass aObj; aObj.someFnct(); return 0; }
The b.h fileCode:#include "b.h" #include "x.h" class AClass { ... ... BClass bObj; XClass xObj; void someFnct (); }; //------------------------- void AClass::someFnct () { bObj.foo(); ... ... xObj.problemFnct (bObj); }
The x.h fileCode:const int MAX = 50; class BClass { int num; char str[MAX]; ... ... void foo(); }; //------------------------- void BClass::foo () { AClass aObj; <-- ??? ... ... }
How can I call a function or create an object that belongs to AClass from classes B and XCode:template <class T> class XClass { ... ... void problemFnct(T &data); }; //------------------------- template <class T> void XClass::problemFnct(T &data); { AClass aObj; <-- ??? ... ... aObj.someFnct(); <-- ??? }![]()



LinkBack URL
About LinkBacks



