POV-Ray : Newsgroups : povray.advanced-users : Object Oriented POV code : Re: Object Oriented POV code Server Time
29 Jul 2024 14:15:49 EDT (-0400)
  Re: Object Oriented POV code  
From: Warp
Date: 21 Feb 2004 16:04:04
Message: <4037c7c4@news.povray.org>
Christopher James Huff <cja### [at] earthlinknet> wrote:
> don't need primitive types.

  I disagree with this. (Unless you are ready to add operator overloading.)

> Just straight public inheritance, probably with categories 
> and interfaces.

  I have no idea what "categories" are, but interfaces are obsolete.
If you want to make an "interface", just make an abstract class.

> I'm undecided about private/protected access. They would 
> be a good thing to have from the language design point of view, but 
> aren't really necessary...

  They are necessary, believe me... ;)

  I would even go so far that member variables are always private (ie.
you *can't* make them public).
  If this is too drastic, then the language would work so that a public
member variable can be moved to the private part and overloaded with
an accessor method (which is used in the same way as when accessing
the variable directly).
  That is, if you had this: class Foo { public: int i; };
you can now replace it with something like:
class Foo { public: int i(); private: int i_; }
  Accessing 'i' would still be the same (ie. eg. "instance.i") but after
the change it calls the method i() instead of reading the variable
directly.
  (For this to work you need to be able to call a method taking no
parameters without parentheses, which shouldn't be any problem.)

  (The idea of all this is, of course, that you can later change
the implementation of 'i' without breaking potentially tons of code.)

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

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