Fixed.cpp
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* Fixed.cpp :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: gychoi <gychoi@student.42seoul.kr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2023/08/02 17:46:11 by gychoi #+# #+# */ 9 /* Updated: 2023/08/02 20:35:13 by gychoi ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include <iostream> 14 #include "Fixed.hpp" 15 16 Fixed::Fixed(void) : _rawBits(0) 17 { 18 std::cout << "Default constructor called" << std::endl; 19 } 20 21 Fixed::Fixed(Fixed const& fixed) 22 { 23 std::cout << "Copy constructor called" << std::endl; 24 _rawBits = fixed.getRawBits(); 25 } 26 27 Fixed& Fixed::operator=(Fixed const& fixed) 28 { 29 std::cout << "Copy assignment operator called" << std::endl; 30 _rawBits = fixed.getRawBits(); 31 return (*this); 32 } 33 34 Fixed::~Fixed(void) 35 { 36 std::cout << "Destructor called" << std::endl; 37 } 38 39 int Fixed::getRawBits(void) const 40 { 41 std::cout << "getRawBits member function called" << std::endl; 42 return (_rawBits); 43 } 44 45 void Fixed::setRawBits(int const raw) 46 { 47 std::cout << "setRawBits member function called" << std::endl; 48 _rawBits = raw; 49 }