M
Mon
I am in the process of reorganizing my code and came across and I came
across a problem, as described in the subject line of this posting.
I have many classes that have instances of other classes as member
variables. So including a forward declaration doesnt help, does it?
Faced with these, I had the following options:
-Include the appropriate header in the header file that contains the
class definition that has a member variable that is a class instance
as opposed to a pointer to the class
-Change the member variable from being a class instance to a class
pointer.
I have the following questions:
1) Which approach is *better* and why?
2) If you need to include the header and the forward declaration of
the class doesnt help(which is reasonable) what do you do?
For now, Im using this
#ifndef __FILE_H
#include "File.h"
#endif
Thanks in advance.
across a problem, as described in the subject line of this posting.
I have many classes that have instances of other classes as member
variables. So including a forward declaration doesnt help, does it?
Faced with these, I had the following options:
-Include the appropriate header in the header file that contains the
class definition that has a member variable that is a class instance
as opposed to a pointer to the class
-Change the member variable from being a class instance to a class
pointer.
I have the following questions:
1) Which approach is *better* and why?
2) If you need to include the header and the forward declaration of
the class doesnt help(which is reasonable) what do you do?
For now, Im using this
#ifndef __FILE_H
#include "File.h"
#endif
Thanks in advance.