Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!orion.cf.uci.edu!uci-ics!ucla-cs!rjc From: rjc@maui.cs.ucla.edu Newsgroups: comp.lang.c++ Subject: Reassigning base member of derived class Message-ID: <25416@shemp.CS.UCLA.EDU> Date: 4 Jul 89 03:41:17 GMT Sender: news@CS.UCLA.EDU Reply-To: rjc@CS.UCLA.EDU (Robert Collins) Organization: UCLA Computer Science Department Lines: 44 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 -------------------------------------------------------------------------------