POV-Ray : Newsgroups : povray.off-topic : new C# stuff : Re: new C# stuff Server Time
6 Sep 2024 17:20:08 EDT (-0400)
  Re: new C# stuff  
From: Darren New
Date: 22 Jan 2009 16:10:51
Message: <4978e0db$1@news.povray.org>
Warp wrote:
> Darren New <dne### [at] sanrrcom> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.