From d58e51d3e48f0d34385d63768cd1bec6803c8940 Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Thu, 17 Oct 2024 16:27:00 +0200 Subject: [PATCH] Change comparison operators to return bool --- ex02/Fixed.cpp | 12 ++++++------ ex02/Fixed.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ex02/Fixed.cpp b/ex02/Fixed.cpp index 502ae74..1d6acbe 100644 --- a/ex02/Fixed.cpp +++ b/ex02/Fixed.cpp @@ -62,32 +62,32 @@ float Fixed::toFloat() const return (static_cast(m_num) / (1 << point_pos)); } -int Fixed::operator==(const Fixed &other) const +bool Fixed::operator==(const Fixed &other) const { return (m_num == other.m_num); } -int Fixed::operator!=(const Fixed &other) const +bool Fixed::operator!=(const Fixed &other) const { return (!(*this == other)); } -int Fixed::operator>(const Fixed &other) const +bool Fixed::operator>(const Fixed &other) const { return (m_num > other.m_num); } -int Fixed::operator<(const Fixed &other) const +bool Fixed::operator<(const Fixed &other) const { return (!(*this >= other)); } -int Fixed::operator>=(const Fixed &other) const +bool Fixed::operator>=(const Fixed &other) const { return (*this == other || *this > other); } -int Fixed::operator<=(const Fixed &other) const +bool Fixed::operator<=(const Fixed &other) const { return (!(*this > other)); } diff --git a/ex02/Fixed.h b/ex02/Fixed.h index 26e03e4..5e3854a 100644 --- a/ex02/Fixed.h +++ b/ex02/Fixed.h @@ -18,12 +18,12 @@ class Fixed Fixed &operator=(const Fixed &other); - int operator==(const Fixed &other) const; - int operator!=(const Fixed &other) const; - int operator>=(const Fixed &other) const; - int operator<=(const Fixed &other) const; - int operator>(const Fixed &other) const; - int operator<(const Fixed &other) const; + bool operator==(const Fixed &other) const; + bool operator!=(const Fixed &other) const; + bool operator>=(const Fixed &other) const; + bool operator<=(const Fixed &other) const; + bool operator>(const Fixed &other) const; + bool operator<(const Fixed &other) const; Fixed operator+(const Fixed &other) const; Fixed operator-(const Fixed &other) const; -- 2.30.2