POV-Ray : Newsgroups : povray.off-topic : new C# stuff : Re: new C# stuff Server Time
6 Sep 2024 09:16:50 EDT (-0400)
  Re: new C# stuff  
From: Darren New
Date: 21 Jan 2009 15:22:28
Message: <49778404$1@news.povray.org>
Kyle wrote:
> I haven't read the whole article yet, only up to the first example, but 
> am wondering why not just use a new class that inherits the string class 
> and add an email check function there? 

Because every function that currently returns a string doesn't have your 
extra code added. Every read from a file, every concatenation of two 
strings, every string literal, every element on a web page, every attribute 
from an XML file, every packet from a socket: all need to get converted to 
your type before you can use them.

The "email check" function might be a poor example.

Think of a "point" object, where you want to be able to calculate the 
distance, for example. Now you have rectangles holding points, windows 
holding rectangles, etc., and you have extra syntax to turn the points in 
the rectangles in the windows into MyPoint objects, just so you can apply 
the method. Or using a separate function unrelated to points and which 
doesn't show up in intelisense.

Plus, of course, that doesn't work if for some reason you can't inherit from 
the object, like it being an integer or something.

-- 
   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.