[4300] in java-interest
array of objects
daemon@ATHENA.MIT.EDU (Charles W. Kann)
Fri Dec 15 17:18:00 1995
From: "Charles W. Kann" <ckann@seas.gwu.edu>
To: java-interest@java.Eng.Sun.COM
Date: Fri, 15 Dec 1995 14:37:11 -0500 (EST)
Hello,
I have a problem which I am trying to implement in Java. It involves
an array of objects from a hierarchy. For example, consider the following:
class a
{
}
class b extends a
{
}
class c extends a
{
}
I want to create an array which will have objects of type b or c. For
example, array[1] might be an object of type b, and array[2] might be of
type c. Objects of type b and c might have slightly different methods and
data. But they are basically examples of things of type a, and I want to
therefore store them in a single array.
How do I do this in Java?
Chuck Kann
ckann@seas.gwu.edu
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com