I'm having issue with initialising a vector in one of my derived classes. I'm using OGRE and want to initialise a position in a derived class called CMissile.
CMissile inherits from CWeapon (which has one pure virtual function).
CWeapon.h:
#include "CPlayer.h"
class CWeapon
{
protected:
CPlayer& myOwner; //Reference to player
Ogre::Vector3 myPosition;
public:
CPlayer getOwner();
virtual void doBehaviour() = 0; //Do not add method body for this in CWeapon.cpp, pure virtual function
};
CMissile.h:
#include "CWeapon.h"
class CMissile : CWeapon
{
private:
float myDirection;
public:
CMissile(float, float, float, float, CPlayer&);
};
and here in CMissile.cpp is where my error resides:
#include "CMissile.h"
CMissile::CMissile(float x, float y, float z, float dir, CPlayer& player)
{
this->myOwner = player;
this->myDirection = dir;
this->myPosition = new Ogre::Vector3(x, y, z); //here is the error, which reads "No operator '=' matches these operands"
}
In CPlayer.h (included in CWeapon) I have the line:
#include <OgreVector3.h>
Does anyone know what I'm doing wrong?