diff --git a/ex01/Fixed.hpp b/ex01/Fixed.hpp index 87128cc..985ca72 100644 --- a/ex01/Fixed.hpp +++ b/ex01/Fixed.hpp @@ -20,11 +20,11 @@ public: std::string toBin(void) const; - friend std::ostream &operator<<(std::ostream &stream, const Fixed &fixed); - private: int value; static const int fracbits; }; +std::ostream &operator<<(std::ostream &stream, const Fixed &fixed); + #endif diff --git a/ex02/Fixed.hpp b/ex02/Fixed.hpp index b931c50..a90f82f 100644 --- a/ex02/Fixed.hpp +++ b/ex02/Fixed.hpp @@ -41,11 +41,11 @@ public: static Fixed &max(Fixed &left, Fixed &right); static const Fixed &max(const Fixed &left, const Fixed &right); - friend std::ostream &operator<<(std::ostream &stream, const Fixed &fixed); - private: int value; static const int fracbits; }; +std::ostream &operator<<(std::ostream &stream, const Fixed &fixed); + #endif diff --git a/ex03/Fixed.hpp b/ex03/Fixed.hpp index f7b1ca2..5b31f18 100644 --- a/ex03/Fixed.hpp +++ b/ex03/Fixed.hpp @@ -43,11 +43,11 @@ public: Fixed abs() const; - friend std::ostream &operator<<(std::ostream &stream, const Fixed &fixed); - private: int value; static const int fracbits; }; +std::ostream &operator<<(std::ostream &stream, const Fixed &fixed); + #endif diff --git a/ex03/Point.cpp b/ex03/Point.cpp index 89abd37..19089e8 100644 --- a/ex03/Point.cpp +++ b/ex03/Point.cpp @@ -13,12 +13,15 @@ Point &Point::operator=(const Point &other) { }; Point::~Point() {} +Fixed Point::getX() const { return x; } +Fixed Point::getY() const { return y; } + Fixed Point::triangleArea(Point const &a, Point const &b, Point const &c) { return (((a.x * (b.y - c.y)) + (b.x * (c.y - a.y)) + (c.x * (a.y - b.y))) / 2) .abs(); } std::ostream &operator<<(std::ostream &stream, const Point &p) { - stream << "(" << p.x << ", " << p.y << ")"; + stream << "(" << p.getX() << ", " << p.getY() << ")"; return stream; } diff --git a/ex03/Point.hpp b/ex03/Point.hpp index 79381d7..791722d 100644 --- a/ex03/Point.hpp +++ b/ex03/Point.hpp @@ -15,11 +15,14 @@ public: Point &operator=(const Point &other); ~Point(); - static Fixed triangleArea(Point const &a, Point const &b, Point const &c); + Fixed getX() const; + Fixed getY() const; - friend std::ostream &operator<<(std::ostream &stream, const Point &point); + static Fixed triangleArea(Point const &a, Point const &b, Point const &c); }; +std::ostream &operator<<(std::ostream &stream, const Point &point); + bool bsp(Point const a, Point const b, Point const c, Point const point); #endif