POV-Ray : Newsgroups : povray.programming : void pointer array problem : Re: void pointer array problem Server Time
28 Jul 2024 08:28:53 EDT (-0400)
  Re: void pointer array problem  
From: Thomas Willhalm
Date: 3 Jul 2002 04:58:05
Message: <3d22bc9c@news.povray.org>
Warp wrote:

> Thorsten Froehlich <tho### [at] trfde> wrote:
>> The proper way is to inherit everything array can hold from a common
>> base class and let array point to those.
> 
>   Yes, that's the right way of doing it. This is one thing where Java
> *forces* you to make good code: There is no void*, but you must use
> inheritance instead in order to achieve this.

No, it doesn't. It's just that the thing is named "object" instead of
"void*". Furthermore, you are forced to use it, if you want to create
generic container classes. In C++, you can easily avoid void* in most
if not all cases and still have static type checking.

(No flame war please. IMO Java has its strengths in other fields.)

Thomas (who really misses templates/generics in Java)


Post a reply to this message

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