|
![](/i/fill.gif) |
Darren New wrote:
> Fredrik Eriksson wrote:
>> On Wed, 21 Jan 2009 21:17:56 +0100, Darren New <dne### [at] san rr com> wrote:
>>>
>>> You always could do it in Smalltalk, just like you do in Ruby. One
>>> advantage C# has is that you're not *actually* changing the string
>>> class; it's just syntactic sugar. It's more like a C++ friend, except
>>> with method/object syntax.
>>
>> It is nothing like 'friend' in C++.
>
> Well, yes, there are a lot of differences. I suppose in thinking more
> it's not really like "friend" at all, no. :-)
Thinking more, it's exactly the *opposite* of friend.
A friend function lets you take something with function-call syntax and give
it access to the private bits of a class as if it were a member.
This thing in C# lets you take something with function-call semantics and
make it look like a member function without giving it access to the private
parts of the class.
But it *is* something that I've missed in lots of OO languages - the ability
to "fix" the built-in classes or classes in libraries without having to
subclass them and deal with getting the right classes instantiated.
--
Darren New, San Diego CA, USA (PST)
"Ouch ouch ouch!"
"What's wrong? Noodles too hot?"
"No, I have Chopstick Tunnel Syndrome."
Post a reply to this message
|
![](/i/fill.gif) |