Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- struct Foo
- {
- Foo(std::string texte) : _texte(texte)
- {
- std::cout << _texte << std::endl;
- }
- void ecrire(const std::string& texte)
- {
- _texte = texte;
- std::cout << _texte << std::endl;
- }
- std::string &_texte;
- };
- struct Bar
- {
- void ecrire(Foo &foo)
- {
- std::string text("mon texte");
- foo.ecrire(text);
- }
- };
- int _tmain(int argc, _TCHAR* argv[])
- {
- Bar bar;
- Foo foo("init");
- bar.ecrire(foo);
- std::cout << foo._texte << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement