-
Weird class problem!
I am having a class named EFX_Camera defined like this:
Code:
struct EFX_CameraSystem
{
EFX_VECTOR3 position;
EFX_VECTOR3 lookat;
};
class EFX_Camera
{
public:
void SetPosition(EFX_VECTOR3 Pos);
void SetLookAt(EFX_VECTOR3 LookAt);
private:
EFX_CameraSystem system;
};
The EFX_VECTOR3 is a class with a constructor EFX_VECTOR3(float x, float y, float z) that passes the parameters values in the class member variables f_x, f_y, f_z.
But I get the error EFX_Camera no approproate default constructor available. (VC++6)
I do not need a constructor for this, but even if I add one, I get this error: EFX_CameraSystem no appropriate constructor available.
Please help, I do not know how to fix this. It is weird.
-
If you add a construtor that takes params, and you wish to use a default constructor, then you must explicitly include one.....the compiler will not do it for you in these circumstances.
Code:
struct EFX_VECTOR3{
EFX_VECTOR3(float x,float y,float z){fx=x;fy=y;fz=z;}
EFX_VECTOR3(){fx=fy=fz=0;}
float fx,fy,fz;
};
>>I do not need a constructor for this
Ah...but you do!
Code:
struct EFX_CameraSystem
{
EFX_VECTOR3 position;
EFX_VECTOR3 lookat;
};
Each of these members are relying on a default constructor
-
Oh thank you. I haven't thought of it.
Well, here is one more thing to my list of C++ knowledge ;)