Method Extension

INTERFACE Directory;

TYPE
  (* The implementation of Directory.T supports
     the following methods: init, m
     all other details are hidden from clients
     brand T so that someone cannot fake their
     own revelation. *)
  PublicT = BRANDED OBJECT METHODS
              init() : PublicT;
              add();
            END;
  T <: PublicT;

END Directory.

(**************************)

INTERFACE FileSystemDirectory;
IMPORT Directory;

TYPE
  (* brand PublicT so that a client cannot fake
     a revelation.
     if this type were not BRANDED, someone
     without the right to see this interface
     could state their own partial revelation
     for Directory.T *)
  PublicT = Directory.T
              BRANDED OBJECT METHODS
                (* we have used method extension
                   dangerous! *)
	        init() : T;
              END;
  T <: PublicT;

END FileSystemDirectory.

(**************************)

MODULE FileSystemDirectory;

IMPORT Directory;

REVEAL
 (* T is a subtype of Directory.T *)
 T = PublicT BRANDED OBJECT OVERRIDES
               (* override any superclass methods
                  that could be dangerous *)
               init := Init;
               add := Add;
             END;

(* the initialization method for T *)
PROCEDURE Init (t: T) : T =
  BEGIN
    (* call initialization on the superclass *)
    RETURN Directory.T.init(t);
  END Init;

BEGIN
END FileSystemDirectory.


Last changed July 17, 1996
whsieh@cs.washington.edu