<- People Behind Informatics


All 0-9 A B C D E F G H I J K L M N O P Q R S T U V W XY Z




 
Virtual Methods
Simula 67 invites a bottom up program design, especially through the possibility of separate compilation of classes. A top down oriented mechanism was introduced through a concept of “virtual procedures”. If a procedure P is specified as virtual in a class C then the binding scheme is semi-dynamic. Any call for P occurring in C or in any subclass of C will bind to that declaration of P which occurs at the innermost prefix level of the actual object containing such a declaration. Thus, the body of the procedure P may, at the prefix level of C, be postponed to occur in any subclass of C. It may even be replaced by more appropriate ones in further subclasses. This binding scheme is dynamic in the sense that it depends on the class membership of the actual object. But there is nevertheless a degree of compiler control; the access can be implemented as indirect through a table produced by the compiler for C and for each of its subclasses. There is an alternative, more implementation-oriented view of virtual procedures. In connection with Simula I, deletion of objects would have to be implicit. But then there is a danger of flooding the memory with useless data, especially if there are implicit pointers between block instances. Fortunately the virtual procedure mechanism provided a solution to the dilemma: a virtual procedure can be seen as a parameter, where the actual parameter is a procedure residing safely within the object itself, at an appropriate prefix level. There is an additional advantage that the procedure has direct access to attributes of the object containing it. This description concerns the virtual methods in Simula. [Source: The Birth of Object Orientation: the Simula Languages]
 

 

<- People Behind Informatics


Home  |  Top  |  Search  |  Gallery  | Glossary  | Sitemap  |  Making Of  |  Help