From 6414382781754680885
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8b682de414fbeb0e
X-Google-Attributes: gidf78e5,public
From: Barry Margolin <barmar@bbnplanet.com>
Subject: Re: Cpp Inheritance = Incest?
Date: 1999/01/14
Message-ID: <rY3n2.125$oD6.9945@burlma1-snr1.gtei.net>#1/1
X-Deja-AN: 432479949
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <77h73o$asm@bgtnsc03.worldnet.att.net>
X-Original-Date: Wed, 13 Jan 1999 16:36:39 GMT
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 916306766 1766 128.250.29.16 (14 Jan 1999 09:39:26 GMT)
Organization: GTE Internetworking, Cambridge, MA
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANp27O+EDnX0m9pzZAQE6bgF+Mg6jhLlmDLmmx/yJegttpbFY88ODuz3R nYmG2xo1wuFS2RKVsYjQmbK5g+K5XPLe =FjKq
NNTP-Posting-Date: 14 Jan 1999 09:39:26 GMT
Newsgroups: comp.std.c++

In article <77h73o$asm@bgtnsc03.worldnet.att.net>,
Anthony Clay <zarthrag@softhome.net> wrote:
>    While writing my own array class in standard ANSI C++ I came across an
>intersting question.  I understand that two different classes can declare to
>be friends with each other, can I class declare itself a friend.

Classes are already friends with themselves.

>    In my class each node in the array has pointers that point to the next
>and previous elements in the array.  However, when constructing and
>'stringing' the seperate nodes together, I want to this object to have
>access to the private members of another member of the same class or
>whatever.

C++ access control is based on classes, not objects.  A member function of
a class can access the private data of that class in any object of that
class, not just the "this" object.

-- 
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Don't bother cc'ing followups to me.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



