X hits on this document

173 views

0 shares

0 downloads

0 comments

15 / 46

© S. Uchitel, 2004

15

References to Objects

What is a reference to an object?

The position in memory where the object is stored in the heap

What is a reference for?

Think of it as what a remote control is to a TV.

Direct interaction with an object is impossible.

Interaction is always through a reference to the object.

What do we do with a reference returned by new?

Store it in a reference variable

Car myCar;

myCar = new Car(“Red”, “Fiat 600”, “25”);

Document info
Document views173
Page views173
Page last viewedTue Jan 24 09:19:33 UTC 2017
Pages46
Paragraphs816
Words2901

Comments