Java/OO newbie question:
main
instantiates Track
class. Now I want that object--track1
--to instantiate many Clip
objects, the number of which will not be known until runtime. From inside the Track
class I can make a new Clip
like this:
Clip clip1 = new Clip(); // this is track1.clip1 from main
But when I want to add more clips based on user input, how and where do I do this? From main
, something like:
Clip track1.clipX = new Clip();
How do I name and reference Clip
objects when I don't know how many there will be?