[fpc-devel] class abstract, class sealed implementation. please review.

fpclist at silvermono.co.za fpclist at silvermono.co.za
Mon Oct 19 11:02:45 CEST 2009


On Monday 19 October 2009 10:47:40 Peter Popov wrote:
> > All features being equal, I would rather have class constants and class
> > types
> > included in FPC.
>
> Class constants are exceptionally bad idea: I've seen a guy define
> PI=3.1415... inside a C++ class! The same functionality already exists in
> fpc: define a (class, inline) function returning the constant value. Then,
> if you are a moron, you will have to write a lot of code to do a senseless
> thing, otherwise possibilities for abuse multiply exponentially :-)

The implementation I'm talking about that would have a constant PI=3.1415 
within say MyClass would only work if called as MyClass.PI

In your example, the global PI would always be defined unless somebody 
redifines it, and then it's not a class constant anyway. 

if OOP is about data encapsulation, why are we using global constants and 
types?

Nino







More information about the fpc-devel mailing list