Created
October 11, 2011 18:21
-
-
Save kaedroho/1278918 to your computer and use it in GitHub Desktop.
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
#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