Skip to content

Glossary: Software Design Patterns in C++

= default

Also written: defaulted function, = default;

Tells the compiler to write the standard version of a special function for you, such as a constructor, destructor or `operator==`. For example, `virtual ~DiscountRule() = default;` gives a base class a virtual destructor, and a defaulted `operator==` compares an `Item` field by field.

Where the book teaches it

Related terms

Virtual destructor= delete