Hello, everyone! I just have a simple question, I think. I have created three unique classes, and each of these classes use some of the others as member variables. However, because of the way the code is organized, I often receive the error "CLASSNAME is not declared" when trying to compile.
For the sake of a concise example, here's code based on my own that gives me an issue.
class A
{
private:
[...]
public:
[...]
void setInfo(int age, C *ptrToC);
};
class B
{
private:
A exampleofA;
public:
[...]
};
class C
{
private:
int age;
A secondexampleofA;
B exampleofB;
public:
[...]
};
As you can see, class A has a pointer to class C, but it returns an error becuase class C has not been created yet. However, I cannot simply move class A down the list because class B depends on class A as well and moving it would cause errors. So what should I do?