Article View: comp.lang.misc
Article #5012Re: THIS virtual SIMULA question
From: lomow
Date: Tue, 01 Dec 1987 16:26
Date: Tue, 01 Dec 1987 16:26
47 lines
1712 bytes
1712 bytes
COMMENT
I compiled and ran the following program (had to add some
semi-colons and replaced the prints by outtext/outimage)
and it produced the following output
ORIGINAL
REDEFINED
REDEFINED
REDEFINED
This is consistent with my understanding of the Simula 67 Common Base
which says (and I don't quote because the quote is quite meaningless)
that if you redefine a virtual quantity, then only outermost definition
is accessible and any other definitions of that quantity are inaccessible.
END COMMENT;
begin
class A;
virtual : procedure X;
begin
procedure X; begin outtext("ORIGINAL"); outimage; end;
comment execute the procedure;
THIS A.X;
inner;
end;
A class B;
begin
procedure X; begin outtext("REDEFINED"); outimage; 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
--
Greg Lomow
lomow@cpsc.calgary.cdn
or
....![ubc-vision,ihnp4]!alberta!calgary!lomow
Technical Details
Message-ID:
<1234@vaxb.calgary.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!alberta!calgary!lomowReferences:
<20919@brunix.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!alberta!calgary!lomow From: lomow@calgary.UUCP Newsgroups: comp.lang.misc Subject: Re: THIS virtual SIMULA question Message-ID: <1234@vaxb.calgary.UUCP> Date: Tue, 1-Dec-87 11:26:39 EST Article-I.D.: vaxb.1234 Posted: Tue Dec 1 11:26:39 1987 Date-Received: Sat, 5-Dec-87 08:39:23 EST References: <20919@brunix.UUCP> Organization: U. of Calgary, Calgary, Ab. Lines: 47