Is there a way you can create an instance of a class that resides within another class? For example:
class foo
{
public:
foo()
{
//Constructor stuff here.
}
class bar
{
bar()
{
//Constructor stuff here.
}
void action(foo* a)
{
//Code that does stuff with a.
}
}
void action(bar* b)
{
//Code that does stuff with b.
}
}
Now I just want to create an instance of bar in my main() like this:
foo* fire;
bar* tinder;
But bar is not declared in this scope. The reason I am using a class within a class is because they both use methods that take the other class as a parameter, but I need an instance of each class in my main(). What can I do?