Obtaining Handles on Objects


Attribute

Object A might maintain a reference to B as one of A’s attributes.

public class Student { 
    Professor facultyAdvisor;
}

Parameter

Object A may be handed a reference to B as an argument of one of A’s methods.

Course c;
Student s;

c.register(s)

Global

A reference to object B may be made “globally available” to the entire application.

Local

Object A may have to explicitly request a handle/reference to B by calling a method on some third object C.


Objects as Clients and Suppliers

We refer to code that invokes a method on an object X as client code relative to X because such code benefits from the services performed by X.

results matching ""

    No results matching ""