What is a class?

A class is the particular object type created by executing a class statement. Class objects provide common behaviour, including code (methods) and shared data (attributes), for instances of a given data type (class).

A class can be based on one or more other classes, called its base class(es). It then inherits the attributes and methods of its base classes. This allows an object model to be successively refined by inheritance. You might have a generic Mailbox class that provides basic accessor methods for a mailbox, and subclasses such as MboxMailbox, MaildirM