1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
#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;
      }
      Vector2D& operator=(const Vector2D& other) {
	 std::cout << "X: assignment operator" << std::endl;
	 x = other.x; y = other.y;
	 return *this;
      }
      double x, y;
};

int main() {
   Vector2D a, b, c;
   c = b = a;
}