예제 #1
0
int main()
{
    Mammal *pDog = new Dog;
    pDog->move();
    pDog->speak();
    return 0;
}
예제 #2
0
int main()
{
	Mammal *pDog = new Dog;
	pDog->move(); // pDog is a Mammal pointer. The mammal method gets called.
	pDog->speak(); // ... but the Mammal.speak() method is virtual, so the Dog.speak() method is used instead.
	return 0;
}
예제 #3
0
파일: main.cpp 프로젝트: IOFeed/JLiberty
int main()
{
  Mammal *pDog = new Dog;
  pDog->move();
  pDog->speak();
  //pDog->tail();
  cout << "--------------\n";
  Mammal *super =  new Dog;
  super->speak();
  super->move();
  cin.get();
  return 0;
}
예제 #4
0
int main()
{
    Mammal *pCat = new Cat;
    pCat->speak();
    return 0;
}