Exercise: Factory Method

Test your understanding of the factory method design pattern.

First problem statement

Refactor the simple factory method implementation of the example to std::shared_ptr as discussed in the previous lesson.

Coding challenge

Note: We’ve already written the example for you using the unique_ptr. You need to refactor the code using the shared_ptr pointer.

Get hands-on with 1400+ tech skills courses.