. Hence, its access is restricted. The member function of derived class can
access the members of base class. The function show() does the same.
From the last program it is clear that handling public data of a class is not a tough task for the program-
mer. However, for accessing private data members, difficulties are faced by the programmer, because they
cannot be accessed without member functions. Even the derived class has no permission to access private
data directly. Hence, the programmer needs to define separate constructor and member functions to access the
private data of that particular ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.