/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Fixed.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/06/20 10:07:44 by narnaud #+# #+# */ /* Updated: 2022/06/20 10:42:53 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ #include "Fixed.hpp" const int Fixed::_fract_bits = 8; Fixed::Fixed (void) { std::cout << "Fixed default constructor called " << std::endl; _raw_bits = 0; } Fixed::Fixed (const int init_val):_raw_bits(init_val) { std::cout << "Fixed parameter constructor called" << std::endl; } Fixed::Fixed (Fixed const & src) { std::cout << "Fixed copy constructor called" << std::endl; _raw_bits = src.getRawBits(); } Fixed & Fixed::operator= (Fixed const & src) { std::cout << "Fixed assignment operator called" << std::endl; _raw_bits = src.getRawBits(); return (*this); } Fixed::~Fixed (void) { std::cout << "Fixed default destructor called" << std::endl; } int Fixed::getRawBits(void) const { std::cout << "getRawBits member function called" << std::endl; return (_raw_bits); } void Fixed::setRawBits(int const raw) { std::cout << "setRawBits member function called" << std::endl; _raw_bits = raw; }