Exemplo n.º 1
0
int main() {
    Hen *hen = new Hen(); //Create new Hen object
    Hen::Nest *nest = new Hen::Nest(); //Create new Nest object
    Hen::Nest::Egg *egg = new Hen::Nest::Egg(); //Create new Egg object
    hen->display(); //Calling display() function from Hen class
    nest->display(); //Calling display() function form Nest class
    egg->display(); //Calling display() from Egg class
    delete hen; //Delete hen object
    delete nest; //Delete nest object
    delete egg; //Delete egg object
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
	Hen	hen;
	Hen::Nest nest;
	Hen::Nest::Egg egg;

	hen.display();
	nest.display();
	egg.display();

	return 0;	
}
void Hen::display(Hen::Nest& n, Hen::Nest::Egg& e) {
	n.display(e);
	std::cout << "Hen.display()" << std::endl;
}