Dynamic arrays question 
Author Message
 Dynamic arrays question

I'm a newbie in RealBasic though I think I know a bit about programming
in general.

Here's my question : Is it possible to have a dynamic array which can
hold data of diffent classes (each of these different classes inherits
from a common class).  I remember doing something like that in Java, but
I wonder if it is possible to do it in RealBasic.

Would it be better to create a linked list structure with some sort of
reference to some void data (if RB has an equivalent for void data).

I hope my formulation actually made some sense..

BobbyWatson



Sun, 25 Apr 2004 01:58:57 GMT  
 Dynamic arrays question

Quote:

> Here's my question : Is it possible to have a dynamic array which can
> hold data of diffent classes (each of these different classes inherits
> from a common class).  I remember doing something like that in Java, but
> I wonder if it is possible to do it in RealBasic.

You can make an array of the common class, since subclasses belong to
the common class, too:

dim myArray(-1) as CommonClass
myArray.append new Subclass

Check out the array methods (such as .append) in the online reference.

(You could also make an array of type Variant and store anything in it.)

Quote:
> Would it be better to create a linked list structure with some sort of
> reference to some void data (if RB has an equivalent for void data).

I'd guess that an array would be easier to deal with, but it really all
depends on what you're trying to accomplish.

HTH.

--
"In a world full of lies / That tug at the truth
 I'm taking no sides / Now I recognize you." -DS



Sun, 25 Apr 2004 04:36:28 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Question about array ops on arrays of types of arrays of ...(ack)

2. dynamic arrays

3. Dynamic Array?

4. Dynamic array dimensioning

5. Dynamic Arrays in PBU's PB 3.2

6. dynamic arrays in FB/PB?

7. Dynamic Arrays in Clarion

8. Dynamic array of groups: what problems

9. Dynamic Array access

10. Pointers and dynamic arrays - not for the faint hearted - very invloved

11. sparse matrix or dynamic array help!

12. sparse matrix or dynamic array

 

 
Powered by phpBB® Forum Software