1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
#include <iostream>

class Vector2D {
   public:
      Vector2D() : x(0), y(0) {
	 std::cout << "X: default constructor" << std::endl;
      }
      Vector2D(const Vector2D& other) : x(other.x), y(other.y) {
	 std::cout << "X: copy constructor" << std::endl;
      }
      double x, y;
};

void foo(Vector2D v) {
}

int main() {
   Vector2D a;
   Vector2D b = a; // equivalent to: Vector2D b{a}
   foo(b);
}