What is an Object?

An object is an instantiation of a class.

Software objects are often used to model real-world objects you find in everyday life.

A object has a state and behavior.

  • dogs have state (name, color, breed, hungry) and behavior (barking, fetching, and wagging tail).
  • bicycles have state (current gear, current pedal cadence, two wheels, number of gears) and behavior (braking, accelerating, slowing down, changing gears).


    Note: Packaging an object's variables within the protective custody of its methods is called encapsulation

 

 

© Lynne Grewe