Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main.cpp:
- #include <iostream>
- #include <string>
- #include "test.h"
- int main()
- {
- std::string s = "We ";
- test t(s);
- std::cout << s;
- }
- //test.h:
- #include <string>
- class test {
- public:
- test(std::string& s);
- std::string store;
- };
- //test.cpp:
- #include "test.h"
- #include <iostream>
- test::test(std::string& s) {
- store = s;
- store += "added this";
- s += "injected this";
- std::cout << store << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement