1
0
This repository has been archived on 2025-01-26. You can view files and clone it, but cannot push or open issues or pull requests.
CPP_Module_02/ex00/Fixed.cpp
2024-11-18 17:50:34 +01:00

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; }