fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A
  5. {
  6. int x,y;
  7. public:
  8. A(int _x, int _y):x(_x),y(_y){}
  9. void Print()
  10. {
  11. cout << x << ',' << y << '\n';
  12. }
  13. };
  14.  
  15. class B
  16. {
  17. A a[2];
  18. public:
  19. B():a({{1,2},{3,4}})
  20. {}
  21.  
  22. void Print()
  23. {
  24. a[0].Print();
  25. a[1].Print();
  26. }
  27. };
  28.  
  29.  
  30. int main()
  31. {
  32. B b;
  33. b.Print();
  34. return 0;
  35. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
1,2
3,4