|
![](/i/fill.gif) |
Warp wrote:
> Darren New <dne### [at] san rr com> wrote:
>> Warp wrote:
>>> The idea with having objects rather than raw data is that objects can
>>> be made abstract, ie. have an abstract public interface which hides the
>>> implementation).
>
>> So why is it better to have member functions at all, vs just passing the
>> object to a function? What's the benefit of being able to say
>> p = pixels[23].lightened();
>> vs
>> p = lightened(pixels[23]); // Like you would in Java
>
> The benefit is that, at least in theory, the member function can be
> dynamically bound, while the regular function can't.
BTW, it *can* be dynamically bound in languages where this is supported. Ada
leaps to mind. There's no distinguished-caller syntax in Ada - all the OO
features are done by what *looks* like overloading but actually turns out to
be dynamic binding if you've said to do so.
But yeah, it's syntax sugar, like overloading operators is.
--
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) |