Discussion: Want to add an object to an array whilst inheriting another object?
In the previous quiz, Online Java Quiz, we tested our experience gained from the course.
2 messages from 2 displayed.
//= Settings::TRACKING_CODE_B ?> //= Settings::TRACKING_CODE ?>
In the previous quiz, Online Java Quiz, we tested our experience gained from the course.
Hi Jensen, this is a design question. It's a good practice to separate
concerns so usually there're classes like ClimberManager which contain the
climber collection (the ArrayList
) and methods for managing it.
There can be methods like addClimber()
,
removeClimber()
etc.
Classes are always available to each other if they're in the same package. So
the ClimberManager
class will be able to use the
Climber
and Mountain
classes. Maybe you meant how you
access the instances? You'll call public methods on the
managers to access their data and work with them. You typically pass the needed
managers in other managers' constructors.
I suggest to introduce a MountainManager
class as well with an
ArrayList
containing the mountain instances.
2 messages from 2 displayed.