- Examples
In this lesson, we'll look at a couple of examples of type erasure.
We'll cover the following...
We'll cover the following...
Example 1: Type Erasure Using Object-Oriented Programming
Explanation
The key point is that you can use instances of Foo or Bar instead of an instance for BaseClass. std::vector<BaseClass*> (line 35) has a pointer to BaseClass. Well, actually it has two pointers to BaseClass (derived) objects and it is a vector of such ...