summaryrefslogtreecommitdiff
path: root/ex00/Fixed.cpp
diff options
context:
space:
mode:
authorDominik Kaiser2025-02-13 13:18:56 +0100
committerDominik Kaiser2025-02-13 13:18:56 +0100
commit80234b81fd22f737d3c86f5993745b1c7053a56a (patch)
tree7841a9d8c9c8caaf5f2ce289f1e0949ed40cbca1 /ex00/Fixed.cpp
parent9aeae0c6e3d453cab20c0279747d6cb804d49a91 (diff)
downloadcpp02-80234b81fd22f737d3c86f5993745b1c7053a56a.tar.gz
cpp02-80234b81fd22f737d3c86f5993745b1c7053a56a.zip
Implement Fixed class
Diffstat (limited to 'ex00/Fixed.cpp')
-rw-r--r--ex00/Fixed.cpp28
1 files changed, 27 insertions, 1 deletions
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 <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/12 17:06:18 by dkaiser #+# #+# */
-/* Updated: 2025/02/12 17:06:30 by dkaiser ### ########.fr */
+/* Updated: 2025/02/13 13:17:58 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
#include "Fixed.hpp"
+
+#include <iostream>
+
+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;
+}