Object Model

SETREF is implemented using a structured programming style. Every attempt is made to use an object-oritented style that should be familiar to those who have programmed in C++ (especially those who are familiar with cfront).

SETREF is implemented using the C programming langauge, which provides little support for either object-oriented programming or modularization. One of the constructs which will become familiar to the SETREF application programmer is the context ("ctx"), which is analogous to class in C++. Similar to object-oriented programming languages, instances of these contexts are "constructed" and "destructed." Of course, this being C, the application programmer must call the functions that provide this behavior, which are the ubiquitous create and delete functions.

Data hiding (the "private data members" of C++) is implemented by declaring these contexts (or at least part of them) C's opaque void*. The pointer points to the hidden data, but it is inaccessible because a pointer of type void cannot be dereferenced.

Virtual methods (the "virtual public member functions" of C++) are implemented using the familiar vtbl construct. Contexts with virtual methods always inherit their interfaces from a base class. The base class defines macros that are used to access its methods. These macros provide some of the magic supplied by object-oriented programming languages. Contexts with virtual methods always have a virtual delete method.


Copyright © 1996, 1997, Visa International Service Association and MasterCard International Incorporated
All Rights Reserved.