AAnimal.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* AAnimal.cpp :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2025/12/18 16:26:41 by bchanot #+# #+# */
  9. /* Updated: 2025/12/18 18:47:20 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "AAnimal.hpp"
  13. /*
  14. ** ------------------------------- CONSTRUCTOR --------------------------------
  15. */
  16. AAnimal::AAnimal() : type("Default")
  17. {
  18. std::cout << "An animal type Default is born." << std::endl;
  19. }
  20. AAnimal::AAnimal( std::string const & type ) : type(type)
  21. {
  22. std::cout << "An animal type " << this->type << " Is born." << std::endl;
  23. }
  24. AAnimal::AAnimal( const AAnimal & src ) : type(src.type)
  25. {
  26. std::cout << "An animal type " << this->type << " Is born." << std::endl;
  27. }
  28. /*
  29. ** -------------------------------- DESTRUCTOR --------------------------------
  30. */
  31. AAnimal::~AAnimal()
  32. {
  33. std::cout << "An animal type " << this->type << " has died..." << std::endl;
  34. }
  35. /*
  36. ** --------------------------------- OVERLOAD ---------------------------------
  37. */
  38. AAnimal & AAnimal::operator=( AAnimal const & rhs )
  39. {
  40. if ( this != &rhs )
  41. {
  42. this->type = rhs.type;
  43. }
  44. return *this;
  45. }
  46. std::ostream & operator<<( std::ostream & o, AAnimal const & i )
  47. {
  48. (void)i;
  49. //o << "Value = " << i.getValue();
  50. return o;
  51. }
  52. /*
  53. ** --------------------------------- METHODS ----------------------------------
  54. */
  55. /*
  56. ** --------------------------------- ACCESSOR ---------------------------------
  57. */
  58. /* ************************************************************************** */