Skip to content

Instantly share code, notes, and snippets.

@jesyspa
Created June 24, 2012 19:26
Show Gist options
  • Save jesyspa/2984604 to your computer and use it in GitHub Desktop.
Save jesyspa/2984604 to your computer and use it in GitHub Desktop.
A better implementation of a 1D point
class PointGood {
private:
int x_;
public:
PointGood(int x) : x_(x) {}
int GetX() const {
return this->x_;
}
};
void g() {
PointGood const p(5);
std::cout << p.GetX(); // works
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment