Skip to content

Instantly share code, notes, and snippets.

@imduffy15
Created March 29, 2013 23:19
Show Gist options
  • Select an option

  • Save imduffy15/5274330 to your computer and use it in GitHub Desktop.

Select an option

Save imduffy15/5274330 to your computer and use it in GitHub Desktop.
#include <iostream>
class Test {
private:
std::string* message;
public:
Test();
void setMessage(std::string* message);
void putMessage();
};
int main() {
Test item = Test();
std::string hello = "Hello World";
item.setMessage(&hello);
item.putMessage();
return 0;
}
Test::Test() {}
void Test::setMessage(std::string* message) {
this->message = message;
}
void Test::putMessage() {
std::cout << *this->message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment