Solution
Here is the solution to the problem in the previous lesson.
We'll cover the following
Explanation
We applied the following changes::
- We turned
struct
into aclass
and kept only the necessary functions as public - With having
m_a
private and not exposing a setter, we cannot changem_a
from the outside world, only with assignment. - We turned
getA()
into a const function so that we cannot accidentally change any member in the function.
Get hands-on with 1400+ tech skills courses.