MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / Box

Method Box

Examples/NoModules/Chapter 12/Ex12_05A/Ex12_05A.cpp:22–26  ·  view source on GitHub ↗

A basic copy constructor

Source from the content-addressed store, hash-verified

20
21// A basic copy constructor
22Box::Box(const Box& box)
23 : m_length{ box.m_length }, m_width{ box.m_width }, m_height{ box.m_height }
24{
25 std::cout << "Copy constructor called." << std::endl;
26}
27
28// A delegating copy constructor
29//Box::Box(const Box& box) : Box{ box.m_length, box.m_width, box.m_height }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected