main.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* main.cpp :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2025/07/17 15:10:40 by bchanot #+# #+# */
  9. /* Updated: 2025/12/18 18:54:02 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "AAnimal.hpp"
  13. #include "Dog.hpp"
  14. #include "Cat.hpp"
  15. #include <iostream>
  16. #include <limits>
  17. int main( void ) {
  18. AAnimal* animals[10];
  19. for (int i = 0; i < 5; i++)
  20. animals[i] = new Dog();
  21. for (int i = 5; i < 10; i++)
  22. animals[i] = new Cat();
  23. for (int j = 0; j < 10; j++)
  24. delete animals[j];
  25. const AAnimal* a = new Dog();
  26. const AAnimal* b = new Cat();
  27. delete a;//should not create a leak
  28. delete b;
  29. return 0;
  30. }