Skip to content

Instantly share code, notes, and snippets.

@kaedroho
Created October 11, 2011 18:21
Show Gist options
  • Save kaedroho/1278918 to your computer and use it in GitHub Desktop.
Save kaedroho/1278918 to your computer and use it in GitHub Desktop.
#include <stdio.h>
class Integer
{
public:
Integer& Inc(int val) { _Value += val; return *this; }
void Print() const { printf("%d", _Value); }
void operator=(int rhs) { _Value = rhs; }
private:
int _Value;
};
int main(int argc,char* argv[])
{
Integer MyInt;
MyInt = 10;
MyInt.Inc(20).Inc(30);
MyInt.Print();
while(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment