Multiple inclusion of header file c++
- by iSight
Hi,
I have a problem regarding multiple inclusion of header file in C++ code.
say for example, i have three class X,Y,Z. X and Y are derived from Base class Z. And i want to create an instance of X in Y. The code will go like this.
class Z{some code}
class X:public Z{some code};//here #include header of class Z added
class Y:public Z //here #include header of class Z added as well as of X class
{private:
X* mX;//instance of X
some code};
So in this multiple definition of all methods of base class arises. how can i cope with this problem