Object

Objects are created by declaring a class, and then using that class by defining (zero or more, where possible, of) its attributes -- this process is known as instantiation.

 

 

Each object is an instance of a class, that has it’s own attributes (data) and behaviours (methods) that are called upon by the object’s interface (i.e. its inputs / outputs), which strictly control (according to its own rules) how its data is sent and received.

 

We can create many objects of the “Person” class and each can have their own name. attributes and behaviours.

 

They are self contained entities, that have:

 

  • Identity
    • Separate from other objects
      • e.g. a Dog has different breeds, or is called different names
  • Attributes
    • Information that describes their current state
      • e.g a Glass can be full or empty
      • e.g. a Door can be red or blue
  • Behaviour
    • Things they can do
      • e.g. a Car can accelerate, or brake

To identify an object, perhaps think:

  • Is the word a noun?
  • Can you put the word “a”, “an” or  “the” in front of it?

 

Objects don’t have to be tangible, physical or visible items -- e.g. a bank account, time.

 

An object is also referred to as a concrete instance of a class.

Leave a Reply