cpp/CPP02/ex00/Fixed.cpp
2024-12-04 17:29:31 +01:00

34 lines
734 B
C++

#include "Fixed.hpp"
Fixed::Fixed() {
this->rawBits = 0;
std::cout << "Default constructor called" << std::endl;
}
Fixed::~Fixed() {
std::cout << "Destructor called" << std::endl;
}
Fixed& Fixed::operator=(const Fixed &fixed) {
if (this != &fixed) {
this->rawBits = fixed.rawBits;
}
std::cout << "Copy assignment operator called" << std::endl;
return *this;
}
Fixed::Fixed(const Fixed &fixed) {
this->rawBits = fixed.rawBits;
std::cout << "Copy constructor called" << std::endl;
}
int Fixed::getRawBits() const{
std::cout << "getRawBits member function called ";
return this->rawBits;
}
void Fixed::setRawBits(int const raw) {
this->rawBits = raw;
std::cout << "setRawBits member function called" << std::endl;
}