Definition
A specific object created from a class template.
Characteristics
- Created through instantiation
- Has its own state, separate from other instances of the same class
- Has the methods and attributes defined by its class
- Multiple instances can be created from the same class
Examples
- An instance of the
Personclass (Python):r = Person("Rhuadri") - Two separate instances of the same
Personclass, each with their own state (Python):
a = Person("Alisdair")
b = Person("Bernadette")Non-examples
- The class itself: a class is a template, not an instance
- A variable holding a simple value, e.g.,
x = 5