コード例 #1
0
ファイル: main.cpp プロジェクト: RLED/ProjectRichelBilderbeek
int main()
{
  const Cat c;
  c.MakeSound();

  const Dog d;
  d.MakeSound();
}
コード例 #2
0
ファイル: main.cpp プロジェクト: richelbilderbeek/CppTests
int main()
{
  const Cat c;
  c.MakeSound();

  const Dog d;
  d.MakeSound();

  //Now use the same Animal pointer for different animals
  Animal * animal{new Cat};
  animal->MakeSound();
  delete animal;
  animal = new Dog;
  animal->MakeSound();
  delete animal;
}