Re: Can nested class members access private members of nesting class?
From: CoolPint (coolpint_at_yahoo.co.uk)
Date: 12/14/03
- Next message: Jeff Schwab: "Re: how to call an external program?"
- Previous message: Brian Kerrick Nickel: "Re: how to call an external program?"
- In reply to: Jeff: "Re: Can nested class members access private members of nesting class?"
- Next in thread: Jeff Schwab: "Re: Can nested class members access private members of nesting class?"
- Reply: Jeff Schwab: "Re: Can nested class members access private members of nesting class?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 13 Dec 2003 20:39:19 -0800
jeffplus@comcast.net (Jeff) wrote in message news:<a81f684.0312131021.1cf6890c@posting.google.com>...
> Is Container the same as List? You've shown the definition of one,
> then accessed a member of the other.
Sorry about the naming. Yes, List is supposed to be Container. I made
an typing error while trying to copy and paste the section of codes.
Since I was getting confused myself, I found a simpler sample which
demonstrate the point I am trying to ask.
According to the books, the code below should not be compiled since
nested class "inner" is accessing private member of nesting class
"enclose" without being declared a friend, but my compiler doesn't say
anything.
I want to know if this is the standard behaviour and I made a wrong
interpretation of the books or it is my compiler doing something
weird.
class enclose
{
public:
class inner
{
public:
void f(enclose *e)
{
e->x = 1;
e->y = 2;
e->z = 3;
}
};
int x;
protected:
int y;
private:
int z;
};
- Next message: Jeff Schwab: "Re: how to call an external program?"
- Previous message: Brian Kerrick Nickel: "Re: how to call an external program?"
- In reply to: Jeff: "Re: Can nested class members access private members of nesting class?"
- Next in thread: Jeff Schwab: "Re: Can nested class members access private members of nesting class?"
- Reply: Jeff Schwab: "Re: Can nested class members access private members of nesting class?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|