N
Neelesh
I was reading TC++PL (Chapter 11, section 11.5.1 "finding friends")
where it is mentioned that
What I observe is a bit different - it is fine that there is an error
for Xform, but the reason is not that Xform is not in scope - the
reason is that the class's size is not known.
Also, the second line is compiling fine - without any problems. In
other words, I find that the declaration of a friend function or a
class inside a class _does_ bring the name into the scope.
Can somebody explain where I am going wrong?
where it is mentioned that
Like a member function, a friend declaration doesnot introduce a name
into an enclosing space. For example :
class Matrix {
friend class XForm;
friend Matrix invert(const Matrix&);
// ...
} ;
//Xform x; // error, no Xform in scope
Matrix (*p) (const Matrix&) = & invert; // error, no invert() in scope
What I observe is a bit different - it is fine that there is an error
for Xform, but the reason is not that Xform is not in scope - the
reason is that the class's size is not known.
Also, the second line is compiling fine - without any problems. In
other words, I find that the declaration of a friend function or a
class inside a class _does_ bring the name into the scope.
Can somebody explain where I am going wrong?