|
![](/i/fill.gif) |
Warp wrote:
> Thorsten Froehlich <tho### [at] trf de> 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
|
![](/i/fill.gif) |