M
mwebel
Hi,
i have another problem:
i have a container basis class and want to write a virtual "copyFrom()"
function.
Basically the child class should copy from another child class.
************************
class Basis{
public:
virtual void copyfrom(basis & obj)=0;
}
class Child: public Basis{
public:
int x;
void copyfrom(Basis & obj){
//Problem is Basis has no element "x"!!
x=obj.x;
};
}
************************
(i know x should not be public... just to lazy to write getter)
thing is:
how can i write the basis class already so that it'll accept the future
child of it as an argument?
or is it not a problem? can i just do it?
thanks for any answers...
i have another problem:
i have a container basis class and want to write a virtual "copyFrom()"
function.
Basically the child class should copy from another child class.
************************
class Basis{
public:
virtual void copyfrom(basis & obj)=0;
}
class Child: public Basis{
public:
int x;
void copyfrom(Basis & obj){
//Problem is Basis has no element "x"!!
x=obj.x;
};
}
************************
(i know x should not be public... just to lazy to write getter)
thing is:
how can i write the basis class already so that it'll accept the future
child of it as an argument?
or is it not a problem? can i just do it?
thanks for any answers...