Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!brutus.cs.uiuc.edu!zweig From: zweig@brutus.cs.uiuc.edu (Johnny Zweig) Newsgroups: comp.lang.c++ Subject: Re: When polymorphic, when not? Message-ID: <1989Dec7.205354.1549@brutus.cs.uiuc.edu> Date: 7 Dec 89 20:53:54 GMT References: <22395@brunix.UUCP> Sender: news@brutus.cs.uiuc.edu Reply-To: zweig@cs.uiuc.edu Organization: U of Illinois, CS Dept., Systems Research Group Lines: 17 I think C-front's behavior in this case is wrong. The function val() takes an actual B as an argument (not a pointer to a thing of type B) -- so it ought to get a memberwise copy of the B members of its argument, and should not have the subclass-of-B virtual function pointer (consider the case in which the subclass virtual function manipulates members that are not even members of a B; those didn't even get passed in to val()!). It seems the rule ought to be "if it takes a Foo, it takes a real-live Foo (including doing the Foo version of virtual functions. If it takes a pointer/reference to a Foo, it will be able to find all the stuff it needs to do the Polymorphic Thang." Of course, since Cfront is the specification of the language, this might be an incorrect argument. -Johnny