Date: Wed, 09 Nov 2022 15:31:50 +0000
Hi,
When you implement a class and desire certain types or data have their access controlled, it doesn't necessarily mean you need a new class type. Data hiding and protection can be good when sharing data among class methods. Not every method need access to all declared data and types inside the class.
This proposed feature can also lead to more intuitive refactoring. Similar to how several lambdas inside a function can lead to the realization of a new class type.
I really appreciate your response!
James S.
------- Original Message -------
On Monday, November 7th, 2022 at 7:23 PM, Jason McKesson via Std-Proposals <std-proposals_at_[hidden]> wrote:
> 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.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
When you implement a class and desire certain types or data have their access controlled, it doesn't necessarily mean you need a new class type. Data hiding and protection can be good when sharing data among class methods. Not every method need access to all declared data and types inside the class.
This proposed feature can also lead to more intuitive refactoring. Similar to how several lambdas inside a function can lead to the realization of a new class type.
I really appreciate your response!
James S.
------- Original Message -------
On Monday, November 7th, 2022 at 7:23 PM, Jason McKesson via Std-Proposals <std-proposals_at_[hidden]> wrote:
> 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.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2022-11-09 15:31:58