Behaviours

An object’s behaviours define the things an object can do.

 

 

For example, a person can walk, talk, eat, etc. These are all activities or behaviours that a person can perform or carry out, usually upon the data available to it. e.g. if a person object was instructed to walk, it might need to know in what direction or for how long, using the information available from the variables it has access to, i.e. its attributes.

 

In OO terminology, behaviours are referred to as methods.

 

Methods are akin to functions in general programming terminology.

 

Methods may alter the state of an object (setter) or simply provide ways of accessing it (getter).

Leave a Reply