0

write the definition in c++ for a class named vector2d that stores information about a two-dimensional vector. the class should have functions to get and set the x and y components, where x and y are integers

next, overload the * operator so that it returns the dot product of two vectors

(Ax+Bx)+(Ay+By)

so far I have this

```
# include <iostream>
# include <vector>
class Vector2D
{
public Vector2D() { _x = _y = 0; }
public Vector2D(float x, float y) { _x = x; _y = y; }
public Vector2D(Vector2D other) { _x = other._x; _y = other._y; }
private float _x, _y;
void set(const _x, const _y ) {X=x; Y=y; }
void set(const vector2d & p) { X=p.X; Y=p.Y; }
getLength() const { return sqrt(X*X + Y*Y ); }
getLength() const { return X*X + Y*Y ; }
}
vector2d operator*(const vector2d& other) const { return vector2d(X * other.X, Y * other.Y); }
vector2d& operator*=(const vector2d& other) { X*=other.X; Y*=other.Y; return *this; }
dotProduct(const vector3d<T>& other) const
{
return X*other.X + Y*other.Y + Z*other.Z;
}
```