Chapter3_2-ObjectsAndInstanceAtributes

Variables are a variables are a allocated in memory

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: crs1 crs2 A A Course crs1, crs2, Course Course B B A. Variables are A. Variables are A. allocated in memory. allocated in memory. crs1 = new Course( ); crs2 B. The reference to the new B. The reference to the new B. = crs1; object is assigned to crs1 . . object is assigned to crs1 C C C. The reference in crs1 C. The reference in crs1 C. is assigned to crs2. is assigned to crs2. Code Page 13 State of Memory Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Assigning an Object Reference From One Variable to Another A. Variables are A. Variables are A. allocated in memory. allocated in memory. A. .Variables are A Variables are assigned references assigned references of objects. of objects. A A Course crs1, crs2, B B crs1 = new Course( ); crs2 = new Course( ); crs2 C. The reference in crs2 C. The reference in crs2 C. is assigned to crs1. is assigned to crs1. crs1 = crs2; C C Page 14 crs2 Dr. S. GANNOUNI & Dr. A. TOUIR crs1 crs2 crs1 Course Course Course Course crs1 Course Course Course Course Introduction to OOP Accessing Instance Attributes • In order to access attributes of a given object: • use the dot (.) operator with the object reference (instance variable) to have access to attribu...
View Full Document

This document was uploaded on 03/03/2014.

Ask a homework question - tutors are online