#C++ Forward Referencing
21-Mar-90 14:30:03
Sb: #24520-#C++ Forward Referencing
Fm: John M. Dlugosz 74066,3717
To: Bob Goldrich 73427,2414
Yea, you're right. I had been thinking about the line in the DRM that
says, "If a function mentioned as a friend has not been declared its nam is
entered in the same scope as the name of the class containing the friend
declaration." which says nothing about only allowing non-member functions.
After posting that, I starting thinking about declarations for member
functions. That is, could you say Y::foo(); on a line somewhere? Unless
I could find a rule prohibiting it, why not? As far as I can tell it would
be useless though.
I looked in the new ARM and found that the commentary does state that,
"This implies that a friend daclaration may be the first mention of a class
or function name. However, there is no way of declaring a member function
earlier than its class. <example shown, similar to this case>. The only
way of specifying mutual friendship between two classes is to declare all
of the second class a friend ofthe [sic] first."
–John