Top.Mail.Ru
The C++ Community's Journal -- Day
? ?
The C++ Community's Journal -- Day [entries|friends|calendar]
The C++ Community

[ userinfo | livejournal userinfo ]
[ calendar | livejournal calendar ]

friend functions and namespaces? [05 Mar 2007|05:19pm]
Why is it that if I do:
namespace myspace {
  class Test {
    protected:
    int n;
    friend void testit(Test);
  };
}

void testit(myspace::Test t)
{
  t.n = 5;
}


I'm scolded with errors saying that n is protected, but if I remove the namespace declaration, everything works fine? What's the correct way to do this? I'm about to abandon namespaces entirely if they're such a chore.
5 comments|post comment

navigation
[ viewing | March 5th, 2007 ]
[ go | previous day|next day ]
Image