Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #13409
| From | ales.pergl@gmail.com |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Typedef of inaccessible type |
| Date | 2012-01-16 07:19 -0800 |
| Organization | http://groups.google.com |
| Message-ID | <16049260.2342.1326727184057.JavaMail.geo-discussion-forums@vby1> (permalink) |
| References | <29510730.1476.1326458883399.JavaMail.geo-discussion-forums@yqni15> <jepds4$tth$1@dont-email.me> <2860857.953.1326466829576.JavaMail.geo-discussion-forums@vbtv21> <jepjvt$42v$1@dont-email.me> |
>
> class ClassA
> {
> friend class Class;
>
> class ClassB
> {
> friend class Class;
>
> class ClassC
> {
> public:
> void doStuff();
> };
> };
> };
>
Interestingly enough, this has its own issues. With this approach, ClassA (and ClassB) is blindly giving friendship to any class Class. I'm not entirely sure what the standard says about this, but I've tested with VC10 that if I include this class declaration in two different modules where each defines its own class Class, the linker doesn't complain about any naming issues and both "Class"es joyfully access ClassA's private members. Possibly it's because as long as class Class is fully defined and kept private to a module, there's no ambiguity from the linker's point of view.
Seems to me that macros really win this one, hands down. :)
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Typedef of inaccessible type ales.pergl@gmail.com - 2012-01-13 04:48 -0800
Re: Typedef of inaccessible type "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-13 15:07 +0100
Re: Typedef of inaccessible type ales.pergl@gmail.com - 2012-01-13 07:00 -0800
Re: Typedef of inaccessible type "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-13 16:52 +0100
Re: Typedef of inaccessible type ales.pergl@gmail.com - 2012-01-16 07:19 -0800
Re: Typedef of inaccessible type jgk@panix.com (Joe keane) - 2012-01-16 16:13 +0000
Re: Typedef of inaccessible type Markku Linnoskivi <markku.linnoskivi@gmail.com> - 2012-01-13 06:09 -0800
Re: Typedef of inaccessible type Victor Bazarov <v.bazarov@comcast.invalid> - 2012-01-13 10:54 -0500
Re: Typedef of inaccessible type Leigh Johnston <leigh@i42.co.uk> - 2012-01-13 14:32 +0000
Re: Typedef of inaccessible type Leigh Johnston <leigh@i42.co.uk> - 2012-01-13 14:38 +0000
Re: Typedef of inaccessible type "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-13 15:46 +0100
Re: Typedef of inaccessible type Leigh Johnston <leigh@i42.co.uk> - 2012-01-13 14:53 +0000
Re: Typedef of inaccessible type ales.pergl@gmail.com - 2012-01-13 06:42 -0800
Re: Typedef of inaccessible type Leigh Johnston <leigh@i42.co.uk> - 2012-01-13 15:04 +0000
Re: Typedef of inaccessible type Leigh Johnston <leigh@i42.co.uk> - 2012-01-13 15:19 +0000
csiph-web