29 lines
697 B
C++
29 lines
697 B
C++
#include "Fixed.hpp"
|
|
#include <iostream>
|
|
|
|
const int Fixed::fracbits(8);
|
|
|
|
Fixed::Fixed() {
|
|
std::cout << "Default constructor called" << std::endl;
|
|
value = 0;
|
|
}
|
|
|
|
Fixed::Fixed(const Fixed &other) {
|
|
std::cout << "Copy constructor called" << std::endl;
|
|
this->value = other.value;
|
|
}
|
|
|
|
Fixed &Fixed::operator=(const Fixed &other) {
|
|
std::cout << "Copy assignment operator called" << std::endl;
|
|
this->setRawBits(other.getRawBits());
|
|
return *this;
|
|
}
|
|
|
|
Fixed::~Fixed() { std::cout << "Destructor called" << std::endl; }
|
|
|
|
int Fixed::getRawBits(void) const {
|
|
std::cout << "getRawBits member function called" << std::endl;
|
|
return value;
|
|
}
|
|
|
|
void Fixed::setRawBits(int const raw) { value = raw; }
|