Skip to content

Instantly share code, notes, and snippets.

@jesyspa
Created June 24, 2012 19:27
Show Gist options
  • Save jesyspa/2984606 to your computer and use it in GitHub Desktop.
Save jesyspa/2984606 to your computer and use it in GitHub Desktop.
A broken implementation of a 1D point
struct PointBroken {
private:
int x_;
public:
PointBroken(int x) : x_(x) {}
int GetX() const {
this->x_ = 7; // Compiler error: not allowed to modify this->x_.
return this->x_;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment