-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFixed.cpp
More file actions
51 lines (45 loc) · 1.64 KB
/
Fixed.cpp
File metadata and controls
51 lines (45 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Fixed.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zelhajou <zelhajou@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/12 11:43:51 by zelhajou #+# #+# */
/* Updated: 2024/06/12 12:26:48 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
#include "Fixed.hpp"
#include <iostream>
Fixed::Fixed() : _fixedPointValue(0)
{
std::cout << "Default constructor called" << std::endl;
}
Fixed::Fixed(const Fixed &other)
{
std::cout << "Copy constructor called" << std::endl;
*this = other;
}
Fixed &Fixed::operator=(const Fixed &other)
{
std::cout << "Copy assignment operator called" << std::endl;
if (this != &other)
{
this->_fixedPointValue = 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 this->_fixedPointValue;
}
void Fixed::setRawBits(int const raw)
{
std::cout << "setRawBits member function called" << std::endl;
this->_fixedPointValue = raw;
}