This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Object – Oriented Concepts What is an Object? • An object has: o State o Behavior o Identity • The structure and behaviour of similar objects are defined in their common class • Some things are not objects, but are attributes or properties of an object o Eg: A cat may be described by its age and color Fluffy (a cat object ) is 5 years old and is white State • The state of an object is described by the current value of its attributes o Represents the cumulative results of an object’s behaviour o In programming terms, attributes are embodied in an object’s instance variables • All attributes have some value o May be a simple quantity Eg: a person’s net worth is $1 million May denote other objects • Eg: a vending machine may have a collection of chocolate bars Values are usually dynamic • Eg: a person’s net worth may go up or down Occasionally a value is constant • A car’s serial number • The state of an object changes: o In response to events...
View Full Document
This note was uploaded on 11/04/2010 for the course CPSC 233 taught by Professor Li during the Fall '09 term at University of Calgary.
- Fall '09