Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bruceoutdoors
Created September 4, 2014 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bruceoutdoors/5b923b859b2302a5ab8f to your computer and use it in GitHub Desktop.
Save bruceoutdoors/5b923b859b2302a5ab8f to your computer and use it in GitHub Desktop.
Used for tutorial: http://wp.me/p2N4HD-1L
#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