Point.cpp
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* Point.cpp :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: gychoi <gychoi@student.42seoul.kr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2023/08/04 01:21:18 by gychoi #+# #+# */ 9 /* Updated: 2023/08/04 18:05:12 by gychoi ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include "Point.hpp" 14 15 Point::Point(void) : _x(Fixed(0)), _y(Fixed(0)) {} 16 17 Point::Point(float const x, float const y) 18 { 19 const_cast<Fixed&>(_x) = Fixed(x); 20 const_cast<Fixed&>(_y) = Fixed(y); 21 } 22 23 Point::Point(Point const& point) 24 { 25 const_cast<Fixed&>(_x) = point._x; 26 const_cast<Fixed&>(_y) = point._y; 27 } 28 29 Point& Point::operator=(Point const& point) 30 { 31 if (this != &point) 32 { 33 const_cast<Fixed&>(_x) = point._x; 34 const_cast<Fixed&>(_y) = point._y; 35 } 36 return (*this); 37 } 38 39 Point::~Point(void) {} 40 41 Fixed const& Point::getX(void) const 42 { 43 return (_x); 44 } 45 46 Fixed const& Point::getY(void) const 47 { 48 return (_y); 49 }