feat(ex00): it works
This commit is contained in:
commit
b54faafe1d
6 changed files with 105 additions and 0 deletions
29
ex00/Fixed.cpp
Normal file
29
ex00/Fixed.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "Fixed.hpp"
|
||||
#include <iostream>
|
||||
|
||||
const int Fixed::fracbits(8);
|
||||
|
||||
Fixed::Fixed() {
|
||||
std::cout << "Default constructor called" << std::endl;
|
||||
value = 0;
|
||||
}
|
||||
|
||||
Fixed::Fixed(Fixed &other) {
|
||||
std::cout << "Copy constructor called" << std::endl;
|
||||
this->value = other.value;
|
||||
}
|
||||
|
||||
Fixed &Fixed::operator=(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; }
|
||||
Loading…
Add table
Add a link
Reference in a new issue