Frogger3140

A horrible piece of C++

Mar 24th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. //Can this be refined?
  2.  
  3. template<class T> class Vector2
  4. {
  5. public:
  6.     T x, y;
  7.  
  8.     Vector2(T cx, T cy)
  9.     {
  10.         x = cx;
  11.         y = cy;
  12.     }
  13.     Vector2 operator+(Vector2 rhs)
  14.     {
  15.         decltype(rhs) temp(0, 0);
  16.         temp.x = this->x + rhs.x;
  17.         temp.y = this->y + rhs.y;
  18.         return temp;
  19.     }
  20. };
Advertisement
Add Comment
Please, Sign In to add comment