fork download
  1. #include <iostream>
  2.  
  3. struct S1 {
  4. int a;
  5. int b;
  6. };
  7.  
  8. struct S2 {
  9. S2() : p (new S1 {4, 5}){}
  10.  
  11. S1 *p;
  12. };
  13.  
  14. int main() {
  15. S2 s;
  16. std::cout << s.p->a << ' ' << s.p->b;
  17. }
  18.  
Success #stdin #stdout 0s 3060KB
stdin
Standard input is empty
stdout
4 5