C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Real World Programming, private = public

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sat, 2 Sep 2023 11:18:24 -0400
On Sat, Sep 2, 2023 at 9:45 AM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> On Sat, Sep 2, 2023 at 5:42 AM Sebastian Wittmeier wrote:
> >
> > Use a friend function.
>
>
> You'd have to edit the header file to do that. The idea is not to have
> to edit the header file.
>
> Aside from the 'typedef' idea, here's another possibility:
>
> void Manipulate( WebServer &web )
> {
> web.public::some_private_member = 77;
> }

You keep talking about syntax as though that was the problem. It isn't.

You are asking to be able to trivially bypass access controls. That's
the feature you want.

That is not a thing the language should provide. It renders access
controls essentially meaningless. The syntax by which it is provided
is irrelevant when the *functionalty itself* is a bad idea.

Received on 2023-09-02 15:18:36