42 lines
1.5 KiB
C++
42 lines
1.5 KiB
C++
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* Fixed.cpp :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2024/11/12 21:14:55 by adjoly #+# #+# */
|
||
|
/* Updated: 2024/11/12 21:52:16 by adjoly ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "Fixed.hpp"
|
||
|
#include <iostream>
|
||
|
|
||
|
Fixed::Fixed(void) : _number(0) {
|
||
|
std::cout << "Default constructor called" << std::endl;
|
||
|
}
|
||
|
|
||
|
Fixed::Fixed(const Fixed& cpy) {
|
||
|
std::cout << "Copy constructor called" << std::endl;
|
||
|
_number = cpy.getRawBits();
|
||
|
}
|
||
|
|
||
|
Fixed::~Fixed(void) {
|
||
|
std::cout << "Destructor called" << std::endl;
|
||
|
}
|
||
|
|
||
|
Fixed &Fixed::operator=(const Fixed& cpy) {
|
||
|
std::cout << "Copy assignment operator called" << std::endl;
|
||
|
if (this != &cpy)
|
||
|
_number = cpy.getRawBits();
|
||
|
return (*this);
|
||
|
}
|
||
|
|
||
|
int Fixed::getRawBits(void) const {
|
||
|
std::cout << "getRawBits member function called" << std::endl;
|
||
|
return (_number);
|
||
|
}
|
||
|
|
||
|
void Fixed::setRawBits(int const raw) { _number = raw; }
|