aboutsummaryrefslogtreecommitdiff
path: root/cpp02/ex00
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-11-10 09:26:04 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-11-10 09:26:04 +0100
commit9dd7a48967f99793b818f7362ac8e95717186774 (patch)
treed96d81af7cd6d36de7b5e01cab7688b60446f03a /cpp02/ex00
parent631a8d7b6c214da48f7748e78fc8c308960414fb (diff)
downloadpiscine_cpp-9dd7a48967f99793b818f7362ac8e95717186774.tar.gz
piscine_cpp-9dd7a48967f99793b818f7362ac8e95717186774.tar.bz2
piscine_cpp-9dd7a48967f99793b818f7362ac8e95717186774.zip
Added more tests for cpp01/07
Diffstat (limited to 'cpp02/ex00')
-rw-r--r--cpp02/ex00/Fixed.cpp5
-rw-r--r--cpp02/ex00/Fixed.hpp6
-rw-r--r--cpp02/ex00/main_DO_NOT_TURN_ME_IN.cpp (renamed from cpp02/ex00/main.cpp)0
3 files changed, 6 insertions, 5 deletions
diff --git a/cpp02/ex00/Fixed.cpp b/cpp02/ex00/Fixed.cpp
index eb0501b..fc50102 100644
--- a/cpp02/ex00/Fixed.cpp
+++ b/cpp02/ex00/Fixed.cpp
@@ -6,7 +6,7 @@
/* 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 */
+/* Updated: 2020/11/09 13:07:28 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -29,10 +29,11 @@ Fixed::~Fixed()
std::cout << "Destructor called" << std::endl;
}
-void Fixed::operator=(Fixed const& other)
+Fixed& Fixed::operator=(Fixed const& other)
{
std::cout << "Assignation operator called" << std::endl;
m_value = other.getRawBits();
+ return *this;
}
int Fixed::getRawBits() const
diff --git a/cpp02/ex00/Fixed.hpp b/cpp02/ex00/Fixed.hpp
index 2ffe775..c8bdfb0 100644
--- a/cpp02/ex00/Fixed.hpp
+++ b/cpp02/ex00/Fixed.hpp
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/13 11:40:49 by charles #+# #+# */
-/* Updated: 2020/10/19 08:27:01 by cacharle ### ########.fr */
+/* Updated: 2020/11/09 13:10:35 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -21,13 +21,13 @@ public:
Fixed();
Fixed(Fixed const& other);
~Fixed();
- void operator=(Fixed const& other);
+ Fixed& operator=(Fixed const& other);
int getRawBits() const;
void setRawBits(int const raw);
private:
- int m_value;
+ int m_value;
static int const m_fractional_bits = 8;
};
diff --git a/cpp02/ex00/main.cpp b/cpp02/ex00/main_DO_NOT_TURN_ME_IN.cpp
index 494dbb3..494dbb3 100644
--- a/cpp02/ex00/main.cpp
+++ b/cpp02/ex00/main_DO_NOT_TURN_ME_IN.cpp