fix(ex00): make some functions more const

This commit is contained in:
Khaïs COLIN 2025-05-14 14:06:26 +02:00
parent b54faafe1d
commit baadd5bddc
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
2 changed files with 4 additions and 4 deletions

View file

@ -8,12 +8,12 @@ Fixed::Fixed() {
value = 0; value = 0;
} }
Fixed::Fixed(Fixed &other) { Fixed::Fixed(const Fixed &other) {
std::cout << "Copy constructor called" << std::endl; std::cout << "Copy constructor called" << std::endl;
this->value = other.value; this->value = other.value;
} }
Fixed &Fixed::operator=(Fixed &other) { Fixed &Fixed::operator=(const Fixed &other) {
std::cout << "Copy assignment operator called" << std::endl; std::cout << "Copy assignment operator called" << std::endl;
this->setRawBits(other.getRawBits()); this->setRawBits(other.getRawBits());
return *this; return *this;

View file

@ -4,8 +4,8 @@
class Fixed { class Fixed {
public: public:
Fixed(); Fixed();
Fixed(Fixed &other); Fixed(const Fixed &other);
Fixed &operator=(Fixed &other); Fixed &operator=(const Fixed &other);
~Fixed(); ~Fixed();
int getRawBits(void) const; int getRawBits(void) const;