Intuition The ONE core idea
A constructor is the tiny setup routine that runs the instant an object is born, so the object is never left half-built. Every "flavour" of constructor is just a different answer to the question: what values do we start life with?
Before you can read a single line of the parent note, you need a vocabulary. Below is every symbol, keyword, and picture the topic quietly assumes. We build them in order — each one earns its place before the next arrives.
Definition Class and object
A class is a blueprint — a description of what data a thing holds and what it can do. An object (also called an instance ) is one actual thing built from that blueprint.
Picture a cookie-cutter and cookies. The cutter is the class; each cookie is an object. The cutter has no dough in it — it just describes the shape . Every cookie is a separate lump of dough shaped by it.
Intuition Why the topic needs this
Constructors are the step that turns "empty dough" into a finished, ready-to-eat cookie. Without the class/object split there is nothing to construct.
Definition Member (data member / field)
A member is a variable that lives inside every object. In the parent note Point has two members, x and y.
In the picture above, the little boxes drawn inside each cookie are its members. Two different Point objects each have their own x and their own y — changing one cookie's box never touches another's.
Intuition Why the topic needs this
A constructor's entire job is to fill these boxes with sensible starting values. "Fully initialized" literally means "every member box has a value."
int vs int* (pointer)
int x is a box that holds a number directly. int* data is a box that holds an address — a note saying "the real data lives over there ." The * means "pointer to."
Look at the two panels. On the left, an int is the value 5. On the right, an int* is an arrow: the box only stores where the numbers are, and the numbers themselves sit in a separate region called the heap (memory you ask for at runtime with new).
new and delete[]
new int[n] asks the operating system for room to store n integers on the heap and hands back the arrow (address) to the start. delete[] data gives that room back.
Rule: every new[] must be matched by exactly one delete[] — no more, no less.
Intuition Why the topic needs this
The whole "shallow vs deep copy" drama exists only because of this arrow. Copying the arrow (shallow) gives two objects the same faraway data; copying the faraway data too (deep) gives each its own. See Destructors and RAII for who does the delete[].
int* copies the numbers when I copy the box."
Why it feels right: for a plain int, copying the box copies the value.
The truth: copying an int* copies only the arrow . Both arrows now point at the same numbers.
The fix: a deep copy allocates fresh heap room and copies the numbers across.
ClassName&)
A reference is a nickname for an existing object — a second label stuck on the same box, not a copy of it. Written Type&.
Imagine one house with two name-plates on the door: "12 Oak St" and "Grandma's place." Both names open the same door. A reference is the second name-plate — no new house is built.
Intuition Why the topic needs this
The copy constructor's signature is ClassName(const ClassName& other). The & is essential : if the argument were passed by value (a fresh copy), then making that copy would call the copy constructor again... which would make another copy... forever. The reference is what stops the infinite recursion. (This same & reappears in Copy Assignment Operator .)
const
const means "I promise not to change this." A const ClassName& other is a read-only nickname for the source object.
Think of a museum exhibit behind glass: you can look (read) but not touch (write).
Intuition Why the topic needs this
When you copy from an object, you only need to read it. Marking it const (1) documents that, and (2) lets you copy even from objects that are themselves const or are temporary values — which a non-const reference would refuse.
Definition Initializer list
The part after the colon and before the {} in a constructor. It says "build member x starting as 0, build y starting as 0." It initializes members directly , before the body {} runs.
Follow the arrow of time in the figure. First the members are born straight into their given values (the green step). Then the body { } runs (the blue step). Writing x = 0; inside the body would instead let x be born as garbage first and then overwrite it — two steps where one would do. For deeper study see Member Initializer Lists .
Common mistake "The list runs top-to-bottom in the order I typed it."
Why it feels right: you read the line left to right.
The truth: members are built in the order they are declared in the class body , not the order in the list.
The fix: keep the list order matching the declaration order (see the parent note's -Wreorder).
Several functions can share one name if their argument lists differ . The compiler picks the right one by looking at what you pass.
Point(), Point(int), and Point(int,int) are three different recipes that all answer to "Point." Handing over zero, one, or two numbers selects which runs.
Intuition Why the topic needs this
"Default," "parameterized," and "copy" constructors are all just overloads of the one constructor name. Overloading is the mechanism that lets an object be born in different ways.
= default
Tells the compiler "generate the standard version of this for me." Point() = default; brings back the auto-made default constructor after you've written another constructor.
explicit
Placed on a one-argument constructor, it blocks silent conversions like Meter m = 5; while still allowing the deliberate Meter m(5);. More in explicit keyword and implicit conversions .
Intuition Why the topic needs this
These two keywords are the "fine controls" of construction: one re-enables an auto recipe, the other disables an automatic conversion.
member data inside object
default and explicit keywords
Read the arrows as "is needed before." Everything funnels into the Constructors node — which is the parent topic . Once these foundations click, the parent note's deep-copy and delegation ideas, plus Rule of Three Five Zero and Move Semantics — move constructor , become natural next steps.
Self-test: can you answer each before revealing?
A class vs an object — which is the blueprint and which is the built thing? The class is the blueprint; the object (instance) is one actual thing built from it.
What is a data member? A variable that lives inside every object, with its own copy per object.
Difference between int x and int* data? int x holds the value directly; int* data holds an address pointing to values stored elsewhere (the heap).
What must match every new int[n]? Exactly one delete[] to return that heap memory.
What is a reference ClassName&? A second name for the same object — no copy is made.
Why does the copy constructor take its argument by reference? By value would call the copy constructor to make that value → infinite recursion; a reference avoids the copy.
What does const promise in const ClassName&? That the source is only read, not modified — so you may copy from const and temporary objects too.
What does the member-initializer list do that the body {} does not? It initializes members directly at birth, before the body runs — no wasteful default-then-assign.
In what order are members actually initialized? In the order they are declared in the class, not the order written in the list.
What is overloading, and how do constructor flavours use it? Same name, different argument lists; default/parameterized/copy are all overloads of the constructor.
What does = default do? Asks the compiler to generate the standard version (e.g. re-enable the default constructor).
What does explicit prevent? Silent implicit conversions like Meter m = 5;.