I'm trying to make an interactive console program which creates hierarchy of boxes and balls contained in them. I didn't figure out how to create nested boxes and how to navigate between boxes. The problem is by what method's type I should create new instances of Box. If type is void, I can't get reference to that object anymore. If type is not void I have to store references somewhere. What are keywords in google to solve this case? Is there any pattern for that?
The problem is that every changes to hierarchy I can do only at runtime, so no hardcoded instantiations are allowed.
Aucun commentaire:
Enregistrer un commentaire