Advanced C++
Q70 / 100

What is type erasure in C++?

Correct! Well done.

Incorrect.

The correct answer is B) A technique using polymorphism or templates to store and operate on objects of different types through a uniform interface without exposing the concrete type

B

Correct Answer

A technique using polymorphism or templates to store and operate on objects of different types through a uniform interface without exposing the concrete type

Explanation

std::any, std::function, and std::variant use type erasure. std::function<void()> holds any callable without the caller knowing the concrete type.

Progress
70/100