I have a silly problem. I want to make a class (let's call it Classone) that has an object that's an instance of Classtwo as an attribute. So far so good, but when Classtwo has an attribute that's an instance of Classone, I get a compilationerror. I would appreciate if someone could help me out with this problem. Example code follows:
#ifndef CLASSONE_H
#define CLASSONE_H
#include "classtwo.hh"
class Classone{
Classtwo ct;
public:
Classone();
};
#endif
#ifndef CLASSTWO_H
#define CLASSTWO_H
#include "classone.hh"
class Classtwo{
Classone co;
public:
Classtwo();
};
#endif
#include "classone.hh"
Classone::Classone(){}
#include "classtwo.hh"
Classtwo::Classtwo() {}
ok, so this code doesn't do much good, but I hope y'all get the idea.
This problem is causing much frustration so I'm hoping on help quickly.