Skip to main content
edited body
Source Link
Camleon
  • 113
  • 1
  • 9

If you want to use a cpp file for your constructor you should write

// File Vector3.cpp #include "Vector3.h" namespace VectorMath { Vector3::Vector3 (float x, float y, float z) { this->x=x; //... } 

The addition should be implemented as follows if you keep it in the same namespace

 Vector3 Vector3::operator+(const Vector3& v) { return Vector3 (x+v.x,y+v.y,z.vz+v.z); } } 

If you want to use a cpp file for your constructor you should write

// File Vector3.cpp #include "Vector3.h" namespace VectorMath { Vector3::Vector3 (float x, float y, float z) { this->x=x; //... } 

The addition should be implemented as follows if you keep it in the same namespace

 Vector3 Vector3::operator+(const Vector3& v) { return Vector3 (x+v.x,y+v.y,z.v.z); } } 

If you want to use a cpp file for your constructor you should write

// File Vector3.cpp #include "Vector3.h" namespace VectorMath { Vector3::Vector3 (float x, float y, float z) { this->x=x; //... } 

The addition should be implemented as follows if you keep it in the same namespace

 Vector3 Vector3::operator+(const Vector3& v) { return Vector3 (x+v.x,y+v.y,z+v.z); } } 
deleted 1 character in body
Source Link
Camleon
  • 113
  • 1
  • 9

If you want to use a cpp file for your declarationsconstructor you should write

// File Vector3.cpp #include "Vector3.h" namespace VectorMath:: { Vector3::Vector3 (float x, float y, float z)  {   this->x=x;   // ...  } 

The addition should be implemented as follows: if you keep it in the same namespace

Vectormath:: Vector3 VectorMath::Vector3::operator+(const Vector3& v)  {   return Vector3 (x+v.x,y+v.y,z.v.z); //...} } 

If you want to use a cpp file for your declarations you should write

// File Vector3.cpp #include "Vector3.h" VectorMath::Vector3::Vector3 (float x, float y, float z) { this->x=x; // ... } 

The addition should be implemented as follows:

Vectormath::Vector3 VectorMath::Vector3::operator+(const Vector3& v) { return Vector3 (x+v.x,y+v.y,z.v.z); //... } 

If you want to use a cpp file for your constructor you should write

// File Vector3.cpp #include "Vector3.h" namespace VectorMath { Vector3::Vector3 (float x, float y, float z)  {   this->x=x;   //...  } 

The addition should be implemented as follows if you keep it in the same namespace

 Vector3 Vector3::operator+(const Vector3& v)  {   return Vector3 (x+v.x,y+v.y,z.v.z); } } 
Source Link
Camleon
  • 113
  • 1
  • 9

If you want to use a cpp file for your declarations you should write

// File Vector3.cpp #include "Vector3.h" VectorMath::Vector3::Vector3 (float x, float y, float z) { this->x=x; // ... } 

The addition should be implemented as follows:

Vectormath::Vector3 VectorMath::Vector3::operator+(const Vector3& v) { return Vector3 (x+v.x,y+v.y,z.v.z); //... }