Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #10649

Re: Method that only one other class type may access

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 <ian-news@hotmail.com>
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> (permalink)
References <bcec6bc0-d419-48b4-a17a-58efec51260e@j19g2000yqc.googlegroups.com>
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 <bcec6bc0-d419-48b4-a17a-58efec51260e@j19g2000yqc.googlegroups.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:10649

Show key headers only | View raw


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

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Method that only one other class type may access Christopher <cpisz@austin.rr.com> - 2011-10-01 13:32 -0700
  Re: Method that only one other class type may access Christopher <cpisz@austin.rr.com> - 2011-10-01 13:50 -0700
    Re: Method that only one other class type may access Noah Roberts <roberts.noah@gmail.com> - 2011-10-02 11:13 -0700
  Re: Method that only one other class type may access Marcel Müller <news.5.maazl@spamgourmet.com> - 2011-10-01 23:38 +0200
    Re: Method that only one other class type may access Christopher <cpisz@austin.rr.com> - 2011-10-01 15:34 -0700
      Re: Method that only one other class type may access Marcel Müller <news.5.maazl@spamgourmet.com> - 2011-10-02 15:27 +0200
  Re: Method that only one other class type may access Noah Roberts <roberts.noah@gmail.com> - 2011-10-02 11:06 -0700
  Re: Method that only one other class type may access Paul N <gw7rib@aol.com> - 2011-10-03 11:48 -0700
  Re: Method that only one other class type may access Ian Collins <ian-news@hotmail.com> - 2011-10-04 08:10 +1300
    Re: Method that only one other class type may access Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-10-03 20:49 +0000
      Re: Method that only one other class type may access Ian Collins <ian-news@hotmail.com> - 2011-10-04 15:01 +1300
        Re: Method that only one other class type may access Christopher <cpisz@austin.rr.com> - 2011-10-04 14:21 -0700
          Re: Method that only one other class type may access Ian Collins <ian-news@hotmail.com> - 2011-10-05 10:29 +1300
            Re: Method that only one other class type may access Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-10-05 08:19 +0000
              Re: Method that only one other class type may access Ian Collins <ian-news@hotmail.com> - 2011-10-05 21:39 +1300
                Re: Method that only one other class type may access Miles Bader <miles@gnu.org> - 2011-10-05 18:09 +0900
                Re: Method that only one other class type may access Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-10-05 18:30 +0000
  Re: Method that only one other class type may access Werner <werasm@gmail.com> - 2011-10-05 00:02 -0700

csiph-web