A base reference can view a derived object without changing it. A base value is different: it creates an independent base object. Copying the base part out of a derived object is called object slicing. The derived part is not stored in that copy.
#include <iostream>
class Shape {
public:
virtual int sides() const { return 0; }
virtual ~Shape() = default;
};
class Triangle : public Shape {
public:
int sides() const override { return 3; }
};
int main() {
Triangle original;
Shape copy = original;
const Shape& view = original;
std::cout << copy.sides() << ' ' << view.sides() << '\n';
}
The example prints 0 3. copy is a new Shape object containing only the base part, so it uses the base result. view still refers to the original Triangle and uses its override. The triangle itself has not lost anything; the information is missing only from the copy.
Slicing can be quiet because passing a derived object to a by-value base parameter is legal. That makes parameter design important. When a helper only needs to inspect an object polymorphically, accept a const Base&. The reference avoids a copy, while const prevents changes through that view.
The editor contains a helper that takes a base value and a separate probe that calls the original derived object directly. Change the first helper's parameter type; its body and Console probe are supplied. This is one focused repair, not a request to change the inheritance tree. The original derived object outlives both calls, so neither reference dangles. A reference does not extend every possible object's lifetime; it must still refer to something alive.
Edit main.cpp; the supplied Console probes already call your code.
inspect to take const Card& instead of a base value. Expect Inspected: family, with Original: family unchanged.Use Run to inspect the Console, then Submit to check your work.