T
toton
Hi I have a class called Session, which stores a vector of Page, like
vector<Page> Also each Page need's to know the Session to which it is
attached.
Thus I have, (the classes has many other things, I copied only the
portion i needed)
in Session.hpp
#include "Page.hpp"
class Session {
private:
std::vector<Page> _pages;
};
while in Page.hpp
class Session;// forward decl
class Page{
private:
Session* _session;
public:
Page(Session* session) : _session(session) {}
};
Is it the best way to remove cyclic definition problem? Or any way I
can store a reference to Session rather than pointer to Session?
Thanks
abir
vector<Page> Also each Page need's to know the Session to which it is
attached.
Thus I have, (the classes has many other things, I copied only the
portion i needed)
in Session.hpp
#include "Page.hpp"
class Session {
private:
std::vector<Page> _pages;
};
while in Page.hpp
class Session;// forward decl
class Page{
private:
Session* _session;
public:
Page(Session* session) : _session(session) {}
};
Is it the best way to remove cyclic definition problem? Or any way I
can store a reference to Session rather than pointer to Session?
Thanks
abir