I need a way to allow my program to do the following, but I can't seem to set things up (either in the includes or elsewhere) to allow it to do this:
foo.h
bar.hCode:class Status{ public: Status( bool status ) : m_status( status ) {} const bool getMStatus() const { return m_status; } private: bool m_status; friend Bar::Bar(); }; class Foo{ public: Foo():fooStatus(0){} const bool getStatus() const { return fooStatus.getMStatus(); } Status& getStatusObject(){ return fooStatus; } private: Status fooStatus; }
Problem is the compiler complains about "friend Bar::Bar()" because Bar hasn't been declared. I've tried adding both of these to the top of foo.h, but to no avail:Code:class Bar{ public: Bar() :{ mFoo.getStatusObject().m_status = 0; } private: Foo mFoo; };
Code:class Bar; // Compiler complains about no definitionCode:#include "bar.h" // Compiler complains in bar.h that Foo isn't defined



LinkBack URL
About LinkBacks



