Universität Ulm,
Fakultät für Mathematik und Wirtschaftswissenschaften,
SAI
WS 97/98 || Entwicklung objekt-orientierter Bibliotheken || Übungen || Lösung 9
DEFINITION PrintableObjects
(*
* Entwicklung objekt-orientierter Bibliotheken, Aufgabe 16
*
* Abstraktion PrintableObjects aus der Vorlesung.
*)
DEFINITION PrintableObjects;
IMPORT Services, Streams;
(* secondary abstraction for printable objects
which is usually to be supported by type-dependent modules
*)
TYPE
PrintProc = PROCEDURE (s: Streams.Stream; object: Services.Object);
PROCEDURE Support(for: Services.Type; print: PrintProc);
(* supply print method for all instances of `for' and its extensions *)
PROCEDURE SetDefault(s: Streams.Stream; default: ARRAY OF CHAR);
(* sets the per-stream default output text for objects
which do not have an associated print method
*)
PROCEDURE Print(s: Streams.Stream; object: Services.Object);
(* call the print method of `object', or, if not present,
the per-stream default text, or, if not present, a question mark
*)
END PrintableObjects.
WS 97/98 || Entwicklung objekt-orientierter Bibliotheken || Übungen || Lösung 9
Martin Hasch, 23. Januar 1998