cpp/cpp02/ex00/Fixed.cpp
Alexandre POMMIER 8543b33348 correct cpp00
2022-07-23 11:58:33 +02:00

51 lines
1.6 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Fixed.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/22 00:58:04 by apommier #+# #+# */
/* Updated: 2022/07/22 13:23:40 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
#include "Fixed.hpp"
Fixed::Fixed()
{
std::cout << "Default constructor called\n";
this->_value = 0;
}
Fixed::~Fixed()
{
std::cout << "Destructor called\n";
}
Fixed::Fixed(const Fixed& copy)
{
std::cout << "Copy constructor called\n";
this->_value = copy.getRawBits();
}
int Fixed::getRawBits(void) const
{
std::cout << "getRawBits member function called\n";
return (this->_value);
}
void Fixed::setRawBits(int const raw)
{
std::cout << "setRawBits member function called\n";
this->_value = raw;
}
Fixed & Fixed::operator=(const Fixed& op)
{
std::cout << "Assignation operator called" << std::endl;
if (this != &op)
this->_value = op.getRawBits();
return (*this);
}