Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: translator error Message-ID: <558@taumet.com> Date: 19 Jan 91 23:31:49 GMT References: <1991Jan18.205053.22916@linus.mitre.org> Organization: Taumetric Corporation, San Diego Lines: 22 fkuhl@maestro.mitre.org (F. S. Kuhl) writes: >Why does the translator (Sun packaging of AT&T 2.0) object to the >following? I define in a base class SBName a virtual operator >virtual SBName& operator = (const char *); >which I intend to inherit in a derived class, ObjectName... operator= is a special case. It must be a nonstatic member function of a class, and is not inherited (E&S 13.4.3, p 334-5). Briefly, assignment has a predefined meaning for a class object (memberwise copy). You are permitted to specify your own assignment operator for a class (which may do anything at all, and which need not do any assignment). It is too dangerous to blindly inherit a base class assignment operator. If the programmer specified special assignment procedures for a class, the compiler cannot make any assumptions about what should be done for a derived class. -- Steve Clamage, TauMetric Corp, steve@taumet.com