Skip to content
UoL CS Notes

Objects

COMP122 Lectures

An object represents a specific, identifiable part of the world-model:

  • It incorporates (passive) attributes.
    • Variables.
  • It has (active) behaviours, services.
    • Methods.
  • Objects interact by sending messages.
    • Calling methods.

Here is an example of three objects:

Three shape objects each with their own attributes.

Here is an interaction between Russ, the ATM near the guild and his account:

graph LR
Russ -->|"requestBalance()"| ATM
ATM -->|152.50| Russ
ATM -->|"getBalance()"| BA[Bank Account]
BA -->|152.50| ATM

Russ has no idea about what happens inside the ATM and only able to directly interact with his account.