I have three classes and I want to use each of them inside another likeso:
class Object
{
public:
Object();
~Object();
protected:
int x;
int y;
private:
Line l;
Circle c;
};
class Line : public Object
{
public:
Line ()
{
x = x+y;
}
~Line ();
private:
};
class Circle : public Object
{
public:
Circle()
{
x = x/y;
}
~Circle();
private:
};
So the problem here is that I get an error on compilation which says base undefined,
I have tried to use #define
and #ifdefine
, but it doesn't work.
Ideally, what I want to do is to have one object in main
to call and all other variables to be used will be set there and at the same time this object could be different such that it could be a Line
or Circle
.