Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class MyClass1 {
- int i;
- public:
- MyClass1(int ii) : i(ii) {}
- void printMe() { std::cout << i << "\n"; }
- };
- /* ROSSZ:
- class Stuff0 {
- MyClass1 thing(42);
- public:
- };
- */
- /* JÓ#1 */
- class Stuff1 {
- MyClass1 thing;
- public:
- Stuff1() : thing(42) {}
- void printMe() { thing.printMe(); }
- };
- /* JÓ#2 */
- class Stuff2 {
- MyClass1 thing{42};
- public:
- void printMe() { thing.printMe(); }
- };
- int main() {
- Stuff1 s1;
- Stuff2 s2;
- s1.printMe();
- s2.printMe();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement