46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* main.cpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/07/14 02:04:10 by apommier #+# #+# */
|
|
/* Updated: 2022/07/17 11:29:39 by apommier ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "Animal.hpp"
|
|
#include "Dog.hpp"
|
|
#include "Cat.hpp"
|
|
#include "WrongAnimal.hpp"
|
|
#include "WrongCat.hpp"
|
|
|
|
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;
|
|
i->makeSound(); //will output the cat sound!
|
|
j->makeSound();
|
|
meta->makeSound();
|
|
|
|
delete meta;
|
|
delete j;
|
|
delete i;
|
|
|
|
std::cout << std::endl;
|
|
|
|
const WrongAnimal* meta2 = new WrongAnimal();
|
|
const WrongAnimal* i2 = new WrongCat();
|
|
std::cout << i2->getType() << " " << std::endl;
|
|
i2->makeSound(); //will output the WrongAnimal sound!
|
|
meta2->makeSound(); //same
|
|
|
|
delete meta2;
|
|
delete i2;
|
|
|
|
return 0;
|
|
} |