fork download
  1. #include <iostream>
  2. class Point {
  3. public:
  4. int x;
  5. };
  6.  
  7. class Triangle {
  8. public:
  9. Triangle(Point (&corners)[3] ) : corners_(corners) {}
  10. void print() { std::cout << corners_[0].x << " ";}
  11. private:
  12. Point (&corners_)[3];
  13. };
  14.  
  15. int main() {
  16. Point x[3];
  17. x[0].x = 4;
  18. Triangle a(x);
  19. a.print();
  20. x[0].x = 5;
  21. a.print();
  22. return 0;
  23. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
4 5