← ppnm

Exercise "vec"

Tasks:

  1. Devise a class, called "vec", an instance of which should hold three double values: x,y,z.
  2. Implement the relevant constructors. In C#: parametrized and default constructors; in C++: parametrized, default, copy, and move constructors, a destructor, and also copy and move assignment operators (hint: most of them can be declared "default" and then the compiler will create them for you).
  3. Implement the relevant mathematical operators for 3D vectors.
  4. Imlement a simple "print" method for debugging.
  5. C#: override the "ToString" method. C++: overload "operator<<".

Hints: