#include <string>
#include <iostream>
class message {
public:
void setPayload(std::string* s) {
m_str = s;
}
void getPayload(std::string* s) {
s = m_str;
}
private:
std::string* m_str;
};
int main(int argc, char* argv[]) {
message m;
std::string *s = new std::string("hello");
m.setPayload(s);
std::string* t = new std::string();
m.getPayload(t);
std::cout << *t << std::endl;
}
#include <iostream>
class message {
public:
void setPayload(std::string* s) {
m_str = s;
}
void getPayload(std::string* s) {
s = m_str;
}
private:
std::string* m_str;
};
int main(int argc, char* argv[]) {
message m;
std::string *s = new std::string("hello");
m.setPayload(s);
std::string* t = new std::string();
m.getPayload(t);
std::cout << *t << std::endl;
}