Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Simula
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Classes, subclasses and virtual procedures === A more realistic example with use of classes,<ref name="CommonBase"/>{{rp|1.3.3, 2}} subclasses<ref name="CommonBase"/>{{rp|2.2.1}} and virtual procedures:<ref name="CommonBase"/>{{rp|2.2.3}} '''Begin''' '''Class''' Glyph; '''Virtual''': '''Procedure''' print '''Is''' '''Procedure''' print;; '''Begin''' '''End'''; Glyph '''Class''' Char (c); '''Character''' c; '''Begin''' '''Procedure''' print; OutChar(c); '''End'''; Glyph '''Class''' Line (elements); '''Ref''' (Glyph) '''Array''' elements; '''Begin''' '''Procedure''' print; '''Begin''' '''Integer''' i; '''For''' i:= 1 '''Step''' 1 '''Until''' UpperBound (elements, 1) '''Do''' elements (i).print; OutImage; '''End'''; '''End'''; '''Ref''' (Glyph) rg; '''Ref''' (Glyph) '''Array''' rgs (1 : 4); ''! Main program;'' rgs (1):- '''New''' Char ('A'); rgs (2):- '''New''' Char ('b'); rgs (3):- '''New''' Char ('b'); rgs (4):- '''New''' Char ('a'); rg:- '''New''' Line (rgs); rg.print; '''End'''; The above example has one [[Superclass (computer science)|super class]] (Glyph) with two [[Subclass (computer science)|subclasses]] (<code>Char</code> and <code>Line</code>). There is one [[Virtual function|virtual procedure]] with two [[implementation]]s. The execution starts by executing the main program. Simula lacks the concept of [[abstract class]]es, since classes with pure [[Virtual function|virtual procedures]] can be [[Instance (computer science)|instantiated]]. This means that in the above example, all classes can be instantiated. Calling a pure virtual procedure will however produce a [[Runtime (program lifecycle phase)|run-time]] [[Error message|error]].
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Simula
(section)
Add topic