Advanced Object-Oriented Programming Concepts
Q83 / 100

What is "object slicing" in languages like C++?

Correct! Well done.

Incorrect.

The correct answer is B) Losing the derived-class-specific members when a derived object is assigned (by value) to a base-class variable

B

Correct Answer

Losing the derived-class-specific members when a derived object is assigned (by value) to a base-class variable

Explanation

When a derived object is copied into a base-type variable by value, only the base portion is copied, "slicing off" the derived part — a pitfall avoided by using references or pointers.

Progress
83/100