ex00: it works!

This commit is contained in:
Khaïs COLIN 2025-05-30 08:14:26 +02:00
commit 6d4b5788d7
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
16 changed files with 318 additions and 0 deletions

55
ex00/main.cpp Normal file
View file

@ -0,0 +1,55 @@
#include "Animal.hpp"
#include "Cat.hpp"
#include "Dog.hpp"
#include "WrongAnimal.hpp"
#include "WrongCat.hpp"
#include "WrongDog.hpp"
#include <iostream>
int main() {
{
Animal animal1 = Animal();
Animal animal2 = animal1;
Animal animal3;
animal3 = animal1;
}
std::cout << std::endl;
{
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();
j->makeSound();
meta->makeSound();
delete meta;
delete j;
delete i;
}
std::cout << std::endl;
{
const WrongAnimal *meta = new WrongAnimal();
const WrongAnimal *j = new WrongDog();
const WrongAnimal *i = new WrongCat();
std::cout << j->getType() << " " << std::endl;
std::cout << i->getType() << " " << std::endl;
i->makeSound();
j->makeSound();
meta->makeSound();
delete meta;
delete j;
delete i;
}
std::cout << std::endl;
{
const Dog *dog = new Dog();
dog->makeSound();
delete dog;
}
return 0;
}