I get an error when running this code:
Code:
class Material
{
public:
Material(int _r, int _g, int _b);
~Material();
void setColor(int _r, int _g, int _b);
int getR();
int getG();
int getB();
// Operator overloading
Material& operator =(const Material& m)
{
r = m.r;
g = m.g;
b = m.b;
return (*this);
}
private:
int r,g,b;
};
class Sphere
{
public:
Sphere();
~Sphere();
void setRadius(float r);
float getRadius();
void setPosition(Vector3D pos);
Vector3D getPosition();
void setMaterial(Material m);
Material getMaterial();
void setLight(int l);
bool isLight();
private:
Vector3D position;
Material color;
float radius;
bool light;
};
I have no idea what is wrong, but the errors it spits out are:
Code:
In constructor `Sphere::Sphere()':
no matching function for call to `Material::Material()'
candidates are: Material::Material(const Material&)
Material::Material(int, int, int)
And when I press the text, it links to this part of my code:
Code:
// Spherer class defenition
// ------------------------------------------------------------
Sphere::Sphere()
{
position.set(0,0,0);
radius = 1;
}
Thanks for your time