AnimalWrong.cpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* AnimalWrong.cpp :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2025/12/18 16:26:41 by bchanot #+# #+# */
  9. /* Updated: 2025/12/18 17:03:09 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "AnimalWrong.hpp"
  13. /*
  14. ** ------------------------------- CONSTRUCTOR --------------------------------
  15. */
  16. AnimalWrong::AnimalWrong() : type("Default")
  17. {
  18. std::cout << "An animal type Default is born." << std::endl;
  19. }
  20. AnimalWrong::AnimalWrong( std::string const & type ) : type(type)
  21. {
  22. std::cout << "An animal type " << this->type << " Is born." << std::endl;
  23. }
  24. AnimalWrong::AnimalWrong( const AnimalWrong & src ) : type(src.type)
  25. {
  26. std::cout << "An animal type " << this->type << " Is born." << std::endl;
  27. }
  28. /*
  29. ** -------------------------------- DESTRUCTOR --------------------------------
  30. */
  31. AnimalWrong::~AnimalWrong()
  32. {
  33. std::cout << "An animal type " << this->type << " has died..." << std::endl;
  34. }
  35. /*
  36. ** --------------------------------- OVERLOAD ---------------------------------
  37. */
  38. AnimalWrong & AnimalWrong::operator=( AnimalWrong 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, AnimalWrong const & i )
  47. {
  48. (void)i;
  49. //o << "Value = " << i.getValue();
  50. return o;
  51. }
  52. /*
  53. ** --------------------------------- METHODS ----------------------------------
  54. */
  55. void AnimalWrong::makeSound(void) const {
  56. std::cout << "*An undefined animal noise*" << std::endl;
  57. }
  58. /*
  59. ** --------------------------------- ACCESSOR ---------------------------------
  60. */
  61. std::string AnimalWrong::getType(void) const {
  62. return this->type;
  63. }
  64. /* ************************************************************************** */