I am trying to write a C++ program with two classes.
class duck {
Fly fls;
/*...*/
};
class Fly
{
/*...*/
};
In the above code I am trying to use object of class Fly
in class duck but
since the class Fly
is declared after the class duck it shows the error:
Fly does not name a type
but if declare the class Fly
before class duck
the error does not come. How can I use an object of class Fly
in duck
when
it is declared afterwards? thank you!