overload operators en cours
This commit is contained in:
@@ -94,24 +94,44 @@ Fixed & Fixed::operator=( Fixed const & rhs ) {
|
||||
}
|
||||
|
||||
/*
|
||||
* other operators
|
||||
* operators < ; > ; <= ; == ; != ; + ; - ; * ; / ; ++ ; --
|
||||
*/
|
||||
|
||||
//Fixed Fixed::operator+( Fixed const & rhs ) const {
|
||||
// return Fixed( this->toFloat() + rhs.toFloat() );
|
||||
//}
|
||||
bool Fixed::operator< (Fixed const & rhs) const {
|
||||
return this->toFloat() < rhs.toFloat();
|
||||
}
|
||||
bool Fixed::operator> (Fixed const & rhs) const {
|
||||
return this->toFloat() > rhs.toFloat();
|
||||
}
|
||||
//Fixed operator> (Fixed const & rhs) const {
|
||||
bool Fixed::operator<=(Fixed const & rhs) const {
|
||||
return this->toFloat() <= rhs.toFloat();
|
||||
}
|
||||
bool Fixed::operator>=(Fixed const & rhs) const {
|
||||
return this->toFloat() >= rhs.toFloat();
|
||||
}
|
||||
bool Fixed::operator==(Fixed const & rhs) const {
|
||||
return this->toFloat() == rhs.toFloat();
|
||||
}
|
||||
bool Fixed::operator!=(Fixed const & rhs) const {
|
||||
return this->toFloat() != rhs.toFloat();
|
||||
}
|
||||
Fixed Fixed::operator+ ( Fixed const & rhs ) const {
|
||||
return Fixed( this->toFloat() + rhs.toFloat() );
|
||||
}
|
||||
Fixed Fixed::operator- ( Fixed const & rhs ) const {
|
||||
return Fixed( this->toFloat() - rhs.toFloat() );
|
||||
}
|
||||
Fixed Fixed::operator* ( Fixed const & rhs ) const {
|
||||
return Fixed( this->toFloat() * rhs.toFloat() );
|
||||
}
|
||||
Fixed Fixed::operator/ ( Fixed const & rhs ) const {
|
||||
return Fixed( this->toFloat() / rhs.toFloat() );
|
||||
}
|
||||
//void Fixed::operator++( void ){
|
||||
// this->_value += 1;
|
||||
//}
|
||||
//Fixed operator<=(Fixed const & rhs) const {
|
||||
//}
|
||||
//Fixed operator>=(Fixed const & rhs) const {
|
||||
//}
|
||||
//Fixed operator==(Fixed const & rhs) const {
|
||||
//}
|
||||
//Fixed operator!=(Fixed const & rhs) const {
|
||||
//void Fixed::operator--( void ){
|
||||
// this->_value -= 1;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user