liveBook · Manning

Big three

As explained in Object-Oriented Software Design in C++

A C++ class-design rule grouping the destructor, copy constructor, and copy assignment operator as special members that may need coordinated implementation.

The Big Three are a C++ class’s destructor, copy constructor, and copy assignment operator. If one needs explicit implementation instead of the default, implement all three. section 6.2.2

Explicit copy operations must perform member-by-member copying or assignment. Coordinating these special members helps expose the automatic work that can otherwise create unnecessary operations. section 6.2.2

Instrumenting Date inside a vector

A Date class logs its constructors, assignment operator, and destructor while an Appointments vector appends, inserts, prints, and removes dates. The output reveals repeated copies, destructions, allocations, and deallocations, turning an apparently simple test into a performance diagnosis. section 6.2.2

How Object-Oriented Software Design in C++ covers it

How deep it goes
Defines the rule and demonstrates member-wise copying, assignment, self-assignment protection, and logged runtime calls.
Examples
Uses an instrumented Date class, an Appointments vector, append and insertion operations, and constructor or destructor logs.
What you can do after
Diagnose/debug with instrumentation by identifying implicit copies, assignments, destructions, allocations, and deallocations.
How it connects
Connects destructors, copy constructors, copy assignment operators, move constructors, move assignment operators, and C++ vectors.

Also explained in

Compare how 3 books explain big three →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Object-Oriented Software Design in C++. The section links point to the parts of the book it draws on.