Solution

Here is the solution to the problem in the previous lesson.

We'll cover the following

Explanation

The following changes were applied:

  • We turned StringVectorHolder::print into a const function
  • We gave StringVectorHolder::operator[] a const overload
    • It still invoked a compiler error as the return type was a non-const& that discarded the const qualifier, so we turned the return type into a const&.

Get hands-on with 1200+ tech skills courses.