예제 #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
}
예제 #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::Nest::display(Hen::Nest::Egg& e) {
	e.display();
	std::cout << "Hen.Nest.display()" << std::endl;
}