Created
September 4, 2014 11:44
-
-
Save bruceoutdoors/5b923b859b2302a5ab8f to your computer and use it in GitHub Desktop.
Used for tutorial: http://wp.me/p2N4HD-1L
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <sstream> | |
#include <iostream> | |
class Point | |
{ | |
public: | |
typedef std::shared_ptr<Point> SPtr; | |
typedef std::unique_ptr<Point> UPtr; | |
Point(std::string name) : x(0), y(0) { | |
this->name = name; | |
} | |
~Point() { | |
std::cout << "Point '" << name << "' has been destroyed!\n"; | |
} | |
void set(int x, int y) { | |
this->x = x; | |
this->y = y; | |
} | |
int getX() { return x; } | |
int getY() { return y; } | |
std::string toString() { | |
std::stringstream s; | |
s << "[" << x << ", " << y << "]"; | |
return s.str(); | |
} | |
private: | |
int x, y; | |
std::string name; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment