class

A blueprint in code that bundles data and the functions that work on it, from which objects are made.

In more detail

Each object made from a class is called an instance and gets the data fields and methods the class defines. Classes let you model one concept, such as a tree node or a bank account, as a single unit.

Examples

The course writes small classes for its structures: Node, SLL, ChainMap, RingBuffer, Bloom.
Java: almost all code lives in classes; records, enums and interfaces are special kinds of type declaration.
public class Greeter { private final String name; ... }
class Dog:
    def __init__(self, name):
        self.name = name
In this course: In Python a class is defined with the class keyword and its functions are called methods. pytest collects classes whose names start with Test as a way of grouping tests, as long as they do not define their own constructor. Test doubles in the course are small hand-written classes.

Related terms

Taught in

References

Certification courses