54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* Fixed.cpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/09/10 00:54:50 by tigos #+# #+# */
|
|
/* Updated: 2025/09/10 17:33:29 by aortigos ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "Fixed.hpp"
|
|
|
|
// Default constructor
|
|
Fixed::Fixed()
|
|
{
|
|
std::cout << "Default constructor called" << std::endl;
|
|
}
|
|
|
|
// Copy constructor
|
|
Fixed::Fixed(Fixed &other)
|
|
{
|
|
std:: cout << "Copy constructor called" << std::endl;
|
|
this->value = other.value;
|
|
}
|
|
|
|
// Copy assignment operator overload
|
|
Fixed& Fixed::operator=(Fixed const &other)
|
|
{
|
|
std::cout << "Copy assignment operator called" << std::endl;
|
|
if (this != &other)
|
|
this->value = other.getRawBits();
|
|
return (*this);
|
|
}
|
|
|
|
// Destructor
|
|
Fixed::~Fixed()
|
|
{
|
|
std::cout << "Destructor called" << std::endl;
|
|
}
|
|
|
|
// getRawBits()
|
|
int Fixed::getRawBits( void ) const
|
|
{
|
|
std::cout << "getRawBits member function called" << std::endl;
|
|
return (this->value);
|
|
}
|
|
|
|
// setRawBits()
|
|
void Fixed::setRawBits( int const raw )
|
|
{
|
|
this->value = raw;
|
|
} |