Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!rutgers!netnews.upenn.edu!saul.cis.upenn.edu!limsoon From: limsoon@saul.cis.upenn.edu (Limsoon Wong) Newsgroups: comp.std.c++ Subject: the most dissatisfying part of c++ Message-ID: <27634@netnews.upenn.edu> Date: 31 Jul 90 14:46:47 GMT Sender: news@netnews.upenn.edu Reply-To: limsoon@saul.cis.upenn.edu.UUCP (Limsoon Wong) Organization: University of Pennsylvania Lines: 26 the program below is a contrived one. it cannot be compiled. the reason is a type fault. however, it exhibits a very central characteristic of update. something should be done to allow this kinds of programs. ---limsoon. #include class a { public: a& test() { // do some modification to the state of this object, // then ... return *this; }; class b : public a { public: int b; }; main() { b B; B = B.test(); // type violation despite the fact that // `B' and `B.test()' are the same object. }