Programming Note--Comparisons With Other Object Notations

OO Modula-2 C++ Java
Inheritance : Arity Single multiple single, but multiple interfaces
: syntax INHERIT public: (heading) extends
Assignment semantics reference pointer (can be overloaded) reference
Predefined Base Class no no Object
Traced objects tag TRACED (class) n/a all are traced
Untraced objects tag UNSAFEGUARDED (module) all are untraced n/a
Class Definition/declaration CLASS class class
Abstract classes ABSTRACT n/a abstract
methods ABSTRACT virtual; =0 (after heading) abstract
Instantiation declare & CREATE declare or new, automatic new
Automatic Constructor class body method of class name method of class name
Automatic initialization class body constructor initializer clause use constructor
Destruction : manual DESTROY (untraced) ~ in front of class name n/a
: extra steps FINALLY (untraced) n/a Finalize (called on collection)
Overload constructors, operators n/a yes yes
Make data attributes immutable READONLY const final (not strictly immutable)
Override attribute components n/a n/a yes, statically
Parent permission to override n/a virtual n/a
keyword OVERRIDE virtual (optional) redeclare in child class
forbidding of n/a n/a final
Visibility to clients REVEAL public public (each member)
to implementation put in implementation module private private (each member)
to subclasses only place in declaration protected protected
to friend classes n/a friend n/a
Object Selection/assertion GUARD..AS n/a n/a
Class membership ISMEMBER n/a instanceof
Reference to : empty object EMPTY null null
: self SELF this this
Combining OO and Generics define in generic def mod use container classes n/a

Contents