Advertisement
_code_feedback_

Task 1: Point2D.h

Apr 2nd, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. /*
  2.     File: Point2D.h
  3.  
  4.     Author: *REDACTED*
  5.     Created: *REDACTED*
  6.  
  7.     Desc: File containing the class definition for Point2D
  8. */
  9.  
  10. #pragma once
  11. class Point2D
  12. {
  13. public:
  14.     // Default constructor
  15.     Point2D() { x = 0.0f; y = 0.0f; }
  16.  
  17.     // Parameterized constructor
  18.     Point2D(float xVal, float yVal) { x = xVal; y = yVal; }
  19.    
  20.     // Copy constructor
  21.     Point2D(const Point2D& other) { x = other.x; y = other.y; }
  22.  
  23.     // Assignment operator
  24.     void operator=(const Point2D & other) { x = other.x; y = other.y; }
  25.  
  26.     // Destructor
  27.     ~Point2D() {};
  28.  
  29.     float x;
  30.     float y;
  31. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement