[comp.lang.c++] Reassigning base member of derived class

rjc@maui.cs.ucla.edu (07/04/89)

At some point after construction, I need to reassign the (unnamed)
base class member of a derived class.

class base {
	// usual stuff
};

class other_base {
	// usual stuff
};

class derived : public base, public other_base {
	// usual stuff

	void reassign(base&);	// reassign the base member
};

The question is:  How do I write reassign(base&)?

I tried:
	void
	derived::reassign(base& b)
	{
		*this = b;
	}
but this invoked the constructor derived::derived(base&), an unexceptable
result.

It seems like this is something I should be able to do, I just don't
know the syntax...  I have hacked a workaround for my particular
situation, but this is not very satisfying, plus it is inefficient.

Please respond via e-mail.  I will post a summary if the responses are
enlightening.

BTW, I am using g++-1.35.something_or_other.

Thanks,

rob collins
rjc@cs.ucla.edu
-------------------------------------------------------------------------------
rjc@cs.ucla.edu	            C++/Paris on the CM2:  Object Oriented SIMD madness
-------------------------------------------------------------------------------