cpp04 add test
This commit is contained in:
parent
9dd638cd50
commit
edc05d9f4f
@ -6,7 +6,7 @@
|
||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/14 02:04:10 by apommier #+# #+# */
|
||||
/* Updated: 2022/08/03 13:26:10 by apommier ### ########.fr */
|
||||
/* Updated: 2022/08/04 13:59:07 by apommier ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -21,25 +21,26 @@ int main()
|
||||
const Animal* meta = new Animal();
|
||||
const Animal* j = new Dog();
|
||||
const Animal* i = new Cat();
|
||||
std::cout << j->getType() << " " << std::endl;
|
||||
std::cout << i->getType() << " " << std::endl;
|
||||
std::cout << std::endl << j->getType() << " " << std::endl;
|
||||
std::cout << i->getType() << " " << std::endl << std::endl;
|
||||
i->makeSound(); //will output the cat sound!
|
||||
j->makeSound(); //will output the dog sound!
|
||||
meta->makeSound();//will output the animal sound!
|
||||
|
||||
std::cout << std::endl;
|
||||
delete meta;
|
||||
delete j;
|
||||
delete i;
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
const WrongAnimal* meta2 = new WrongAnimal();
|
||||
const WrongAnimal* falseWrongCat = new WrongCat();
|
||||
const WrongCat* realWrongCat = new WrongCat();
|
||||
std::cout << falseWrongCat->getType() << " " << std::endl;
|
||||
std::cout << std::endl << falseWrongCat->getType() << " " << std::endl << std::endl;
|
||||
falseWrongCat->makeSound(); //will output the WrongAnimal sound!
|
||||
meta2->makeSound(); //same
|
||||
realWrongCat->makeSound();//will output the WrongCat sound!
|
||||
std::cout << std::endl;
|
||||
|
||||
delete realWrongCat;
|
||||
delete meta2;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user