Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cca!mirror!rayssd!brunix!nancy!wrc From: wrc@nancy (will cook) Newsgroups: comp.lang.misc Subject: THIS virtual SIMULA question Message-ID: <20919@brunix.UUCP> Date: Sun, 29-Nov-87 18:04:30 EST Article-I.D.: brunix.20919 Posted: Sun Nov 29 18:04:30 1987 Date-Received: Wed, 2-Dec-87 22:21:13 EST Sender: root@brunix.UUCP Reply-To: wrc@brunix.UUCP (will cook) Organization: Brown University Computer Science Dept. Lines: 44 Expires: References: Sender: Followup-To: Distribution: Keywords: I have a rather obscure question about SIMULA, and as there doesn't seem to be a comp.lang.simula, I submit it here for your help. I am interested in what happens when a prefix A with a virtual attribute X is accessed from a subclass using `THIS A.X', where the subclass redefines the virtual. The intended meaning of THIS A seems to be that the object should be accessed AS IF IT WHERE AN INSTANCE OF CLASS A, despite the fact that it might in face be an instance of a subclass. But I think the way virtuals are implemented will cause THIS A.X to access the redefined value, not the original one given in A. Could someone fix this code and execute it to find out what happens? Or send comments on what you think will/should happen. I will summarize the results to the net, if there is any interest. william cook Brown University ihnp4!brunix!wrc ------------------------------------------------------------------- begin class A virtual : procedure X; begin procedure X; begin print "ORIGINAL"; end; comment execute the procedure; THIS A.X(); inner; end A class B begin procedure X; begin print "REDEFINED"; end; comment try to run both procedures; THIS A.X(); THIS B.X(); end; comment try them out; new A; new B; comment will probably print ORIGINAL, ORIGINAL, ORIGINAL, REDEFINED; end