POV-Ray : Newsgroups : povray.off-topic : new C# stuff : Re: new C# stuff Server Time
6 Sep 2024 17:20:41 EDT (-0400)
  Re: new C# stuff  
From: Mike Raiford
Date: 23 Jan 2009 10:45:29
Message: <4979e619@news.povray.org>
Warp wrote:

> 
>   I see no relevant difference to making a function so that you can write
> "DrawButton(g, rcArea, caption)".
> 

Except that in C# everything is defined in a class. So, if the function 
is part of a library, you'd have to either define static methods or 
instance methods. The Graphics class is sealed, so there's no means of 
defining a sub class, such as GraphicEx ...so your choices are define a 
bunch of static methods, or define a class whose constructor takes a 
pointer to a Graphics object, and offers the extended functions.

C# 3.0 offers the extension methods to get around this. It may seem like 
a pointless feature to you, but for some it is a minor convenience.




-- 
~Mike


Post a reply to this message

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