60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
#include "Animal.hpp"
|
|
#include "WrongAnimal.hpp"
|
|
#include "Cat.hpp"
|
|
#include "WrongCat.hpp"
|
|
#include "Dog.hpp"
|
|
|
|
int main() {
|
|
|
|
std::cout << "\n--Test0--\n" << std::endl;
|
|
{
|
|
const Animal* meta = new Animal();
|
|
const Animal* dog = new Dog();
|
|
const Animal* cat = new Cat();
|
|
|
|
std::cout << "\n";
|
|
|
|
std::cout << "animal: " + meta->getType() << std::endl;
|
|
std::cout << "dog: " + dog->getType() << std::endl;
|
|
std::cout << "cat: " + cat->getType() << std::endl;
|
|
std::cout << "dog Sound : ";
|
|
dog->makeSound();
|
|
std::cout << "cat Sound : ";
|
|
cat->makeSound();
|
|
std::cout << "animal Sound : ";
|
|
meta->makeSound();
|
|
|
|
std::cout << "\n";
|
|
|
|
delete meta;
|
|
delete dog;
|
|
delete cat;
|
|
}
|
|
|
|
std::cout << "\n--Test1--\n" << std::endl;
|
|
|
|
{
|
|
const WrongAnimal* wrongAnimal = new WrongAnimal();
|
|
const WrongAnimal* wrongCat = new WrongCat();
|
|
|
|
std::cout << "\n";
|
|
|
|
std::cout << "WrongAnimal: " + wrongAnimal->getType() << std::endl;
|
|
std::cout << "WrongCat: " + wrongCat->getType() << std::endl;
|
|
|
|
std::cout << "WrongAnimal Sound : ";
|
|
wrongAnimal->makeSound();
|
|
std::cout << "WrongCat Sound : ";
|
|
wrongCat->makeSound();
|
|
|
|
std::cout << "\n";
|
|
|
|
delete wrongAnimal;
|
|
delete wrongCat;
|
|
}
|
|
|
|
std::cout << "\n--End--\n" << std::endl;
|
|
|
|
return (0);
|
|
}
|