Class & Objects (Definitions)

Class

Class: An abstract description of all objects that can be made from this set class where an object can be instantiated from.

A Class Contains:

  • Attributes --> the characteristics or qualities that an object of the class possesses

    • Fields: Variables that belong to an object or a class:

      • Type 1: It belongs to the instance of the class

      • Type 2: It belongs to the class itself

  • Methods --> functions defined within a class; actions that objects of the class can perform

Object

In Computer Science (CS):

Object can be a variable, a data structure, a function, or a method; therefore, a location in memory having a value that can be referenced by an identifier.

In Object Oriented Programming (OOP):

Similar to an object as in CS, an object in OOP is an instance of a class where this object can be either a variable, a function, a data structure or a combination of such.

An object is an instance of an abstract class. Example: List is a built-in class of Python.

When you create a variable containing a list, you have created an object from the List class.

Last updated