From: Dominik Kaiser Date: Thu, 13 Feb 2025 12:18:56 +0000 (+0100) Subject: Implement Fixed class X-Git-Url: https://git.dkaiser.de/?a=commitdiff_plain;h=80234b81fd22f737d3c86f5993745b1c7053a56a;p=42%2Fcpp02.git Implement Fixed class --- diff --git a/ex00/Fixed.cpp b/ex00/Fixed.cpp index 6c9e542..206325d 100644 --- a/ex00/Fixed.cpp +++ b/ex00/Fixed.cpp @@ -6,8 +6,34 @@ /* By: dkaiser + +Fixed::Fixed(void) : raw_value(0) { + std::cout << "Default constructor called" << std::endl; +} + +Fixed::Fixed(const Fixed &other) : raw_value(other.getRawBits()) { + std::cout << "Copy constructor called" << std::endl; +} + +Fixed::&operator=(const Fixed &other) { + std::cout << "Copy assignment operator called" << std::endl; + this->raw_value = other.getRawBits(); +} + +Fixed::~Fixed(void) { std::cout << "Destructor called" << std::endl; } + +int Fixed::getRawBits(void) const { + std::cout << "getRawBits member function called" << std::endl; + return this->raw_value; +} +void Fixed::setRawBits(int const raw) { + std::cout << "setRawBits member function called" << std::endl; + this->raw_value = raw; +} diff --git a/ex00/Fixed.hpp b/ex00/Fixed.hpp index 114905d..89ccfe5 100644 --- a/ex00/Fixed.hpp +++ b/ex00/Fixed.hpp @@ -6,26 +6,26 @@ /* By: dkaiser