File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ struct Coordinate {
5353 */
5454 Coordinate operator +(const Coordinate& obj) const ;
5555
56+ Coordinate operator +(const Coordinate2D& obj) const ;
57+
5658 /* *
5759 * @brief Checks if two Coordinate objects are equal.
5860 *
@@ -153,8 +155,6 @@ struct Coordinate2D {
153155 */
154156 Coordinate2D operator +(const Coordinate2D& obj) const ;
155157
156- // TODO: Add Coordinate + Coordinate2D
157-
158158 /* *
159159 * @brief Checks if two Coordinate2D objects are equal.
160160 *
Original file line number Diff line number Diff line change @@ -13,6 +13,14 @@ Coordinate Coordinate::operator+(const Coordinate& obj) const {
1313 return result;
1414}
1515
16+ Coordinate Coordinate::operator +(const Coordinate2D& obj) const {
17+ Coordinate result;
18+ result.x = this ->x + obj.x ;
19+ result.y = this ->y ;
20+ result.z = this ->z + obj.z ;
21+ return result;
22+ }
23+
1624bool Coordinate::operator ==(const Coordinate& obj) const {
1725 return (this ->x == obj.x ) && (this ->y == obj.y ) && (this ->z == obj.z );
1826}
You can’t perform that action at this time.
0 commit comments