[ create a new paste ] login | about

Link: http://codepad.org/OY1I9rsG    [ raw code | output | fork ]

C++, pasted on Jun 30:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>

struct Foo {
    Foo(std::string const& x) : data(x) {}

    std::string data;
};

int main()
{
    std::string a("Hello");
    Foo foo(a);
    Foo* msg = &foo;
    string str = msg->data;
    str = "World";

    std::cout << a << "\n" << str << std::endl;
}


Output:
1
2
Hello
World


Create a new paste based on this one


Comments: