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


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

Re: litb is teh famous (private access specifier is private no more)

From jacob navia <jacob@spamsink.net>
Newsgroups comp.lang.c++
Subject Re: litb is teh famous (private access specifier is private no more)
Date 2012-03-31 10:47 +0200
Organization lccwin
Message-ID <jl6gbd$tm$1@speranza.aioe.org> (permalink)
References <r_WdnZDF0_abbujSnZ2dnUVZ8j2dnZ2d@giganews.com>

Show all headers | View raw


Le 30/03/12 19:53, Leigh Johnston a écrit :
[SNIP]

If you want really private structures just use C:

struct foo;
typedef struct foo *pFoo;

Now you can use struct foo and pFoo everywhere without knowing anything 
about it. You can't allocate a foo, just a pointer to it, and you can't 
have a local variable of that type. It is 100% hidden and since you 
haven't got any description of its internal fields there is NO WAY you 
can access them.

This is much stronger than C++ "private". It has some drawbacks too, the 
main  one is that you can't do some hack to actually use the protected 
fields :-)

jacob

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


Thread

litb is teh famous (private access specifier is private no more) Leigh Johnston <leigh@i42.co.uk> - 2012-03-30 18:53 +0100
  Re: litb is teh famous (private access specifier is private no more) Gareth Owen <gwowen@gmail.com> - 2012-03-31 08:37 +0100
  Re: litb is teh famous (private access specifier is private no more) jacob navia <jacob@spamsink.net> - 2012-03-31 10:47 +0200
    Re: litb is teh famous (private access specifier is private no more) gwowen <gwowen@gmail.com> - 2012-04-03 04:14 -0700
  Re: litb is teh famous (private access specifier is private no more) TJorgenson <tjorgenson@infinera.com> - 2012-03-30 21:29 -0700

csiph-web