Skip to content

Instantly share code, notes, and snippets.

@zxmarcos
Created August 5, 2013 17:44
Show Gist options
  • Select an option

  • Save zxmarcos/6157876 to your computer and use it in GitHub Desktop.

Select an option

Save zxmarcos/6157876 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
using namespace std;
class hello {
public:
hello& message(string msg) {
cout << msg;
return *this;
}
};
class foo {
hello attr;
public:
hello& getThis() {
return attr;
}
};
int main()
{
foo a;
a.getThis().message("Olá mundo!\n");
a.getThis().message("Olá mundo!").message(" mais legal ainda!\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment