Fixed.class.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* Fixed.class.cpp :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@gmail.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2025/07/16 16:07:34 by bchanot #+# #+# */
  9. /* Updated: 2025/07/17 15:33:54 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "Fixed.class.hpp"
  13. #include <iostream>
  14. Fixed::Fixed(void) : _value(0), _integer(8) {
  15. std::cout << "Default constructor called" << std::endl;
  16. return ;
  17. }
  18. Fixed::Fixed(Fixed const &src) : _integer(8) {
  19. *this = src;
  20. std::cout << "Copy constructor called" << std::endl;
  21. return ;
  22. }
  23. Fixed::~Fixed(void) {
  24. std::cout << "Destructor called" << std::endl;
  25. return ;
  26. }
  27. int Fixed::getRawBits(void) const {
  28. std::cout << "getRawBits member function called" << std::endl;
  29. return this->_value;
  30. }
  31. void Fixed::setRawBits(int const raw) {
  32. std::cout << "setRawBits member function called" << std::endl;
  33. this->_value = raw;
  34. return ;
  35. }
  36. Fixed &Fixed::operator=(Fixed const &rhs) {
  37. std::cout << "Copy assignment operator called" << std::endl;
  38. this->_value = rhs.getRawBits();
  39. return *this;
  40. }