Question about class/struct copying

Hello, I'm new here and was wondering if someone could be of assistance.

I was wondering if it's possible to copy a class or struct, to another one which inherits the first said class... To make some example since it seems I can't be clearer than that due to my limited english.

Say, I have a class, and another that inherits from the first one:

class BASE{ //stuff }base;
class ANOTHERCLASS : BASE {
//empty, so basically it's the same class or struct but inherited from the base class
}anotherclass;

I'm wondering if it's possible to make "anotherclass = base;" without having to make an equal for every variable in the class/struct, I know it's possible when both classes are the same (such as having "BASE BASE1;" and "BASE BASE2") then it's possible to make "BASE1 = BASE2;". And I've noticed that it's possible to copy the info from the inherited class into the base class ("base = anotherclass;"), but when I try to copy from the base class to the inherited class (say, "anotherclass = base", even when it's the same, and the inherited its empty) my compiler throws this:

"Error C2679: binary '=' : no operator found which takes a right-hand operand of type 'BASE' (or there is no acceptable conversion)". Is there a way to get around that?

I'm currently working on visual studio 2k8. Any will is appreciated.

Thanks in advance!


Topic archived. No new replies allowed.