Skip to content

Instantly share code, notes, and snippets.

@HybridEidolon
Created December 12, 2012 00:44
Show Gist options
  • Save HybridEidolon/4263832 to your computer and use it in GitHub Desktop.
Save HybridEidolon/4263832 to your computer and use it in GitHub Desktop.
Hello, GitHub Gists 2.0!
#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