Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #86066
| From | JiiPee <kerrttuPoistaTama11@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | New feature in C++ wanted: friend limited to one function only in a class |
| Date | 2022-08-25 20:11 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <te8afp$3mokm$1@dont-email.me> (permalink) |
I had this situation many times, that I wanted to use friend in class
but I dont want friend be able to get
access to ALL members, only maybe one function. I wish there was a
feature in C++ like this:
class Parent
{
private:
void foo() { : friend Child // new feature
}
void foo2() {
}
};
and now Child can get access to foo() and ONLY it:
class Child
{
public:
Parent* m_parent{nullptr}; // later initialized ...
void foo3() {
// Can access only foo()
m_parent->foo(); // this is OK
// cannot access any other privates
m_parent->foo2(); // this is NOT OK
}
};
Can anybody suggest this to Bjarne? hehe
Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread
New feature in C++ wanted: friend limited to one function only in a class JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-08-25 20:11 +0300
Re: New feature in C++ wanted: friend limited to one function only in a class "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-08-25 20:13 +0200
Re: New feature in C++ wanted: friend limited to one function only in a class JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-08-25 23:13 +0300
Re: New feature in C++ wanted: friend limited to one function only in a class JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-08-25 23:11 +0300
Re: New feature in C++ wanted: friend limited to one function only in a class Manfred <noname@add.invalid> - 2022-08-26 01:59 +0200
Re: New feature in C++ wanted: friend limited to one function only in a class JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-08-26 07:19 +0300
Re: New feature in C++ wanted: friend limited to one function only in a class JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-08-26 07:25 +0300
Re: New feature in C++ wanted: friend limited to one function only in a class Paavo Helde <eesnimi@osa.pri.ee> - 2022-08-26 12:13 +0300
Re: New feature in C++ wanted: friend limited to one function only in a class JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-08-26 19:29 +0300
Re: New feature in C++ wanted: friend limited to one function only in a class Paavo Helde <eesnimi@osa.pri.ee> - 2022-08-26 20:49 +0300
Re: New feature in C++ wanted: friend limited to one function only in a class Michael S <already5chosen@yahoo.com> - 2022-08-26 03:55 -0700
csiph-web