diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-04-13 13:07:19 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-04-13 13:07:19 +0200 |
| commit | 3d48ed0312f9c0ae691560d7cd688f46917e3fd4 (patch) | |
| tree | a9ad6b750bfef47e91f85be187ed5a27edd2bd9c /cpp02/ex00/Fixed.cpp | |
| parent | 0f3240844dbd5a874e1565a988ef355ededab6a5 (diff) | |
| download | piscine_cpp-3d48ed0312f9c0ae691560d7cd688f46917e3fd4.tar.gz piscine_cpp-3d48ed0312f9c0ae691560d7cd688f46917e3fd4.tar.bz2 piscine_cpp-3d48ed0312f9c0ae691560d7cd688f46917e3fd4.zip | |
cpp02 base
Diffstat (limited to 'cpp02/ex00/Fixed.cpp')
| -rw-r--r-- | cpp02/ex00/Fixed.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/cpp02/ex00/Fixed.cpp b/cpp02/ex00/Fixed.cpp index e69de29..eb0501b 100644 --- a/cpp02/ex00/Fixed.cpp +++ b/cpp02/ex00/Fixed.cpp @@ -0,0 +1,48 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* Fixed.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/13 11:45:18 by charles #+# #+# */ +/* Updated: 2020/04/13 11:58:37 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "Fixed.hpp" + +Fixed::Fixed() + : m_value(0) +{ + std::cout << "Default constructor called" << std::endl; +} + +Fixed::Fixed(Fixed const& other) +{ + std::cout << "Copy constructor called" << std::endl; + *this = other; +} + +Fixed::~Fixed() +{ + std::cout << "Destructor called" << std::endl; +} + +void Fixed::operator=(Fixed const& other) +{ + std::cout << "Assignation operator called" << std::endl; + m_value = other.getRawBits(); +} + +int Fixed::getRawBits() const +{ + std::cout << "getRawBits member function called" << std::endl; + return m_value; +} + +void Fixed::setRawBits(int const raw) +{ + std::cout << "setRawBits member function called" << std::endl; + m_value = raw; +} |
