Created
December 12, 2012 00:44
-
-
Save HybridEidolon/4263832 to your computer and use it in GitHub Desktop.
Hello, GitHub Gists 2.0!
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 <iostream> | |
#include <string> | |
#include <list> | |
using namespace std; | |
class HelloWorld { | |
public: | |
HelloWorld() : words() {}; | |
~HelloWorld() {}; | |
void print() { | |
for (list<string>::iterator i = words.begin(); i != words.end(); i++) { | |
cout << *(i); | |
} | |
cout << endl; | |
} | |
HelloWorld& operator<<(const char* str) { | |
words.push_back(string(str)); | |
return *this; | |
} | |
private: | |
list<string> words; | |
}; | |
int main(int argc, char** argv) { | |
HelloWorld world; | |
world << "Hello," << " " << "GitHub" << "!"; | |
world.print(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment