[3684] in java-interest

home help back first fref pref prev next nref lref last post

Instanciation by name

daemon@ATHENA.MIT.EDU (Michel MEYER)
Wed Nov 22 06:55:54 1995

Date: Sun, 19 Nov 1995 16:55:48 +0100
To: java-interest@java.sun.com
From: michel@mmania.com (Michel MEYER)

One can read in the JAVA Specification (4.6 Object Creation -- the new
Operator) that there is a form of the new operator which allows name
instanciation, by default calling the default constructor.

Here is what's written:

/-------- begin quote

A third form of allocator allows the class name to be provided as a String
expression. The String is
evaluated at runtime, and new returns an object of type Object, which must
be cast to the desired type.

b = new ( "Class"+"A" );

In this case, the constructor without arguments is called.

/-------- end quote

However, I tryed this and I got an error message at compile time:


test.java:7: 'new(...)' not supported.
                add((A) new ("Class A"));
                        ^


So, as I understand it this feature is not yet implemented. As we are now
already in beta, I am wondering if this will have any chance to be
implemented in future releases, or is it a dropped feature ?

Maybe I missed something ... in any case, I would appreciate any answer



Michel (michel@mmania.com)

########################################################
##    The (virtual) Baguette: http://www.mmania.com   ##
########################################################



-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post