im struggling with syntax here: hopefully this question is v simple, im just miising the point.
specifically, if i nest a class within another class, so for instance
class a
{
a //the constructor
{
b an_instance_of_b // an instance of class b
}
};
class b
{
public:
foo()
{
cout << "foo";
}
};
When i try to access this method within B by doing this:
a an_instance_of_a; //declare an instance of a
an_instance_of_a.an_instance_of_b.foo()
^^ this doesnt seem to work. this is simplified (so might be a typo here somewhere). but i know the classes are being setup fine, its just that i cant access the methods inside them if they are nested. what may i be doing wrong?
many thanks.