Fixed::Fixed(): m_num(0)
{
- std::cout << "Default constructor called\n";
}
Fixed::Fixed(const int init): m_num(init << point_pos)
{
- std::cout << "Int constructor called\n";
}
Fixed::Fixed(const float init): m_num(roundf(init * (1 << point_pos)))
{
- std::cout << "Float constructor called\n";
}
Fixed::Fixed(const Fixed &other)
{
- std::cout << "Copy constructor called\n";
*this = other;
}
Fixed::~Fixed()
{
- std::cout << "Destructor called\n";
}
Fixed &Fixed::operator=(const Fixed &other)
{
- std::cout << "Copy assignment operator called\n";
if (this == &other)
return (*this);
m_num = other.getRawBits();