Please enable JavaScript.
Coggle requires JavaScript to display documents.
Classes and Objects (Lecture 4 & 5) (Objects (state+behaviour+identity…
Classes and Objects (Lecture 4 & 5)
Objects
are abstractions
hides features which are irrelevant to problem domain
state+behaviour+identity
State: value of attribute at a given time
behavior: actions performed or acted upon by other objects
Identity: property that distinguishes it from other objects
Some Java Codes
public void set..NO STATIC
Default constructor: Pizza test = new Pizza(){ test.set(30);}
Class
describes group of objects
similar properties, behaviours and common realtionships
Accessors
get
read property values of objects
Mutators
set property values
used to ensure property values valid