Am 09.08.2008 um 16:32 schrieb Clark Cox:

On Sat, Aug 9, 2008 at 2:20 AM, Thomas Engelmeier
<[EMAIL PROTECTED]> wrote:

Am 08.08.2008 um 00:09 schrieb Ken Worley:



friend != static, and even then this probably would not be valid semantics.

test1* tobj = newtest1(5); has nothing to do with
test1::newtest1( int ) or aTest1Instance->newtest1( int )

I believe that you are incorrect. This is a perfectly valid way of
defining friend functions in C++. Defined this way, newtest1 is a
global function (i.e. it is not scoped to test) that is allowed to
access the private/protected parts of test1 instances.

From the C++ standard (11.4 paragraph 5):
"
A function can be defined in a friend declaration of a class if and
only if the class is a non-local class (9.8),
the function name is unqualified, and the function has namespace
scope. [Example:
   class M {
       friend void f() { } //definition of globalf, a friend ofM,
                           //not the definition of a member function
   };
—end example] Such a function is implicitlyinline. Afriendfunction
defined in a class is in the
(lexical) scope of the class in which it is defined.
"

OOPs.. OK, I just did some cursory research how the friend syntax (I rarely used) is like...

Regards,
        Tom_E

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to