So, given something like
class Outer
{
private:
class Inner
{
private:
int m_member;
};
};
Should Outer be allowed to access Inner's m_member or not?
GCC thinks yes, VC6 thinks no.
thanks!
glen. 8 3594
Glen Able wrote: class Outer { private:
class Inner { private: int m_member; }; };
Should Outer be allowed to access Inner's m_member or not?
No. Outer isnt allowed to access a private member of a nested class.
hth
Christoph
"Glen Able" <re***********************@hoxtmxail.com> wrote in message
news:c0*******************@news.demon.co.uk...
| So, given something like
|
| class Outer
| {
| private:
|
| class Inner
| {
| private:
| int m_member;
| };
| };
|
| Should Outer be allowed to access Inner's m_member or not?
|
| GCC thinks yes, VC6 thinks no.
Unless 'm_member' is static, or there is some kind of
friendship involved, then no, not without an object of
type 'Inner', with an available accessor.
Cheers.
Chris Val
Chris ( Val ) wrote: "Glen Able" <re***********************@hoxtmxail.com> wrote in message news:c0*******************@news.demon.co.uk... | | Should Outer be allowed to access Inner's m_member or not? | | GCC thinks yes, VC6 thinks no.
Unless 'm_member' is static, or there is some kind of friendship involved, then no, not without an object of type 'Inner', with an available accessor.
What do you mean with static? Even if m_member is static it shouldn't be
accessible.
Christoph?
"Christoph Rabel" <od**@hal9000.vc-graz.ac.at> wrote in message
news:40**********************@aconews.univie.ac.at ...
| Chris ( Val ) wrote:
| > "Glen Able" <re***********************@hoxtmxail.com> wrote in message
| > news:c0*******************@news.demon.co.uk...
| > |
| > | Should Outer be allowed to access Inner's m_member or not?
| > |
| > | GCC thinks yes, VC6 thinks no.
| >
| > Unless 'm_member' is static, or there is some kind of
| > friendship involved, then no, not without an object of
| > type 'Inner', with an available accessor.
|
| What do you mean with static? Even if m_member is static it shouldn't be
| accessible.
Why not ?
Cheers.
Chris Val
"Glen Able" <re***********************@hoxtmxail.com> wrote in message
news:c0*******************@news.demon.co.uk... So, given something like
class Outer { private:
class Inner { private: int m_member; }; };
Should Outer be allowed to access Inner's m_member or not?
GCC thinks yes, VC6 thinks no.
Interesting; which version of GCC thinks so? IIRC VC6 is right on this
point.
Chris
Chris ( Val ) wrote: "Christoph Rabel" <od**@hal9000.vc-graz.ac.at> wrote in message | | What do you mean with static? Even if m_member is static it shouldn't be | accessible.
Why not ?
Because its private.
Christoph
"Christoph Rabel" <od**@hal9000.vc-graz.ac.at> wrote in message
news:40***********************@aconews.univie.ac.a t...
| Chris ( Val ) wrote:
| > "Christoph Rabel" <od**@hal9000.vc-graz.ac.at> wrote in message
| > |
| > | What do you mean with static? Even if m_member is static it shouldn't be
| > | accessible.
| >
| > Why not ?
|
| Because its private.
Oop's ;-).
My apologies - I missed that it was private.
I need some shut eye <G>.
Cheers.
Chris Val
> > Should Outer be allowed to access Inner's m_member or not? GCC thinks yes, VC6 thinks no.
Interesting; which version of GCC thinks so? IIRC VC6 is right on this point.
Chris
It's 2.95 or thereabouts, with some custom bits...
Thanks for all the replies! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: pmatos |
last post by:
Hi all,
I have a style question. I've been for long programming in Lisp-like
languages and C when I need a low-level language. Now, I'm programming
for professional reasons in C++ (which I had...
|
by: Abelardo Vacca |
last post by:
Hi,
The title sums up the question pretty much.
I would like to access all private members of a class including the private
members of its base classes.( I already have the ReflectionPermission )...
|
by: yurps |
last post by:
what is the difference between class members which are marked with
these....?
I wonder because I have a namespace with a few different classes...
I want to use a method from another...
|
by: Ken Varn |
last post by:
I have an ASP.NET application that is calling a custom class that is trying
to parse all of the members of my Page object using Type.GetMembers(). The
problem that I am having is that private...
|
by: Klaus Löffelmann |
last post by:
Hi,
how is it possible to have a private class with public members?
When doing some reasearch about double buffered paint actions, I stumbled on
a class GraphicBufferManager which is declared...
|
by: Paul |
last post by:
Hello All,
I am new to C# and dot NET in general. The book I am reading uses the
term "non-public."
I suspect that they don't mean "private", otherwise they would have
said so. What is the...
|
by: newbie120 |
last post by:
Hi all
maybe its just been a long day, but i have a question about call access
modifiers in C#. Consider the following code.
namespace Application
{
private class Class1
{
int i;
|
by: WXS |
last post by:
I know this sounds contrary to the idea of an interface, but read this and
see what you think.
-----------------------------------------------------------------------------------------
It would be...
|
by: jopperdepopper |
last post by:
Hi,
finally giving php 5 a go, and going over the new approach to classes.
Can someone clarify the public, private and protected to me?
I quote the php manual: "The visibility of a property or...
|
by: Zytan |
last post by:
What happens if I do this:
static byte MemberFunction()
instead of:
public static byte MemberFunction()
I know I can't access it. But what does it default to? Private? I
can't find any code...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |