Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: Method that only one other class type may access Date: Tue, 04 Oct 2011 08:10:27 +1300 Lines: 19 Message-ID: <9eufl3F5kfU7@mid.individual.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net KzcE9/swa1YU8lNiTXwOQgdKRO+heS2ToK0Q4NYK9yT0CPnSXT Cancel-Lock: sha1:EhagMX/c25VgvL5RxbfO/HjUbos= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:10649 On 10/ 2/11 09:32 AM, Christopher wrote: > I know I need some sort of friend, but I don't want to friend the > entire class. > > I've got a TcpConnection class and it has a state member. > I've got a TcpListener class that accepts connections and creates a > TcpConnectionClass. > > The TcpListener class needs to be able to change the state member of > the TcpConnection class, but I don't want anyone else to be able to. > How do I go about that? If a design doesn't fit the problem, the design is flawed. It looks to me like you are over engineering what is a very simple (and common) task. Don't fret though, I see this all the time! Socket related activities simply don't fit well within an OO approach. -- Ian Collins