int main()
 {
	 {
     Animal *pCat = new Cat;
     pCat->Speak();
	 }
	//delete pCat;
     return 0;
 }
Beispiel #2
0
int main() {
   Animal *a = nullptr;
   cout << "Do you want a: 1) Dog; 2) Cat? ";
   int selection;
   cin >> selection;
   if (selection == 1)
      a = new Dog();
   else
      a = new Cat();

   cout << "Your pet is " << a->GetAge() << " years old and says ";
   a->Speak();
   cout << "!" << endl;
   return 0;
}
Beispiel #3
0
int main()
{
   Cat cCat("Fred");
   Animal *pAnimal = &cCat;
   cout << "Animal is named " << pAnimal->GetName() << ", and it says " << pAnimal->Speak() << endl;

   int a = 5;

int b = 0;

int &r = a;


r = b++;


cout << a << r << b;
   return 0;
}
Beispiel #4
0
int main()
{
   Animal *pCat = new Cat;
	pCat->Speak();
	return 0;
}
void Report(Animal &rAnimal)
{
    cout << rAnimal.GetName() << " says " << rAnimal.Speak() << endl;
}