C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Namespace with access specifiers in class interface

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Mon, 7 Nov 2022 19:23:18 -0500
On Mon, Nov 7, 2022 at 3:17 PM Smith, Jim via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hi,
>
> Sometimes I'd like to hide data from a subset of class methods while still allowing other methods to access them.

I find this notion to be dubious. If a class is so big that, to ensure
the sanity of the class's state, it becomes necessary to give
individual member functions access to individual data members, then
that class has grown too big and needs to be split out into multiple
classes. The only downside is that it is slightly less convenient, as
the outer class has to explicitly expose the functions of the inner
class.

Received on 2022-11-08 00:25:06