d02 ex00 ok
This commit is contained in:
41
d02/ex00/Fixed.cpp
Normal file
41
d02/ex00/Fixed.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "Fixed.hpp"
|
||||
|
||||
// default/parametric constructor
|
||||
Fixed::Fixed( void ) : _value( 0 ) {
|
||||
std::cout << "Default constructor called" << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
// copy constructor
|
||||
Fixed::Fixed( Fixed const & src ) {
|
||||
std::cout << "Copy constructor called" << '\n';
|
||||
*this = src;
|
||||
return;
|
||||
}
|
||||
|
||||
// destructor
|
||||
Fixed::~Fixed( void ) {
|
||||
std::cout << "Destructor called" << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
// assignement operator
|
||||
Fixed & Fixed::operator=( Fixed const & rhs ) {
|
||||
|
||||
std::cout << "Copy assignment operator called" << '\n';
|
||||
if ( this != &rhs )
|
||||
this->_value = rhs.getRawBits();
|
||||
|
||||
return *this;
|
||||
|
||||
}
|
||||
|
||||
int Fixed::getRawBits( void ) const {
|
||||
std::cout << "getRawBits member function called" << '\n';
|
||||
return this->_value;
|
||||
}
|
||||
|
||||
void Fixed::setRawBits( int const raw ) {
|
||||
this->_value = raw;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user