Textbook Notes (280,000)
CA (160,000)
Ryerson (10,000)
ITM (900)
ITM 200 (20)
Chapter 11

Chapter 11


Department
Information Technology Management
Course Code
ITM 200
Professor
Vikraman Baskaran
Chapter
11

This preview shows half of the first page. to view the full 3 pages of the document.
Chapter 11 – Classes and objects
11.1 What is an object?
Classes can be used to specify blueprints for objects
More on pg 230-231
11.2 ‘Time’ for an example
Example on pg 232
Attributes are also called instance variables
oInstance variables have class scope, ex. they are accessible throughout the class
oThey are usually declared as private, which means they can only be accessed by
the methods of this class and not by methods of other classes
Constructor methods
Characteristics of constructor methods
oAre called upon when a new object is created
oThey have the same name as their class
oParameters if any are often used to give initial values to instance variables
oConstructor methods sometimes do other processing associated with initializing a
new object
oConstructor methods have no return value
Calling a constructor method
A constructor method is called when you create an object of the associated class using
new
Memory is allocated to hold the new object then the appropriate constructor method is
called
Using Timepiece objects
Example on pg 233-234
www.notesolution.com
You're Reading a Preview

Unlock to view full version