[Cs3] making a base class public method private
Mikhail Nesterenko
mnestere at kent.edu
Thu Mar 26 16:31:09 EDT 2026
CS3 students,
We were discussing making a private base class method public in a
derived class today. This is done to selectively expose some of the
base class methods to clients.
There was a question if the opposite is possible: making a public base
class method private this hiding it from the clients.
Apparently, it is possible and is quite straightforward using the same
using::methodName;
mechanism. I updated the example we studied today:
http://antares.cs.kent.edu/~mikhail/classes/cs3/Examples/Adapter/figuresPrivateInheritance.cpp
In the commented out class definition of Square that publicly inherits
from Figure, findCenter is made private.
Thanks,
--
Mikhail
More information about the cs3
mailing list