Object
An object is an instance of a class.
Python Example
In Python, everything is an object, and objects can be:
assigned to a variable
passed as an argument to a function
From the creator of Python, Guido van Rossum:
One of my goals for Python was to make it so that all objects were “first class.” By this, I meant that I wanted all objects that could be named in the language (e.g., integers, strings, functions, classes, modules, methods, etc.) to have equal status. That is, they can be assigned to variables, placed in lists, stored in dictionaries, passed as arguments, and so forth.
# Define a class containing a constructor. class SampleClass: name = "" # Define the constructor to be executed when the class object is created. def __init__(self): self.name = "Sample Class" # Define a method as part of the class. def printname(self): print(self.name) # Create an object using the class. sampleobject = SampleClass() # Use the object. sampleobject.printname()