We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to make my own GUI (for fun and to learn), and I am using the parent-child method (currently a 1 way tree) for rendering and keeping components neat/together(parent moves, child moves with it). I hold my main GUI component that all my GUI components "extends" from, stored in an ArrayList of that. All my components use "Update()" to draw and function. My "GGUI"(head gui component to extend my components from) has an UpdateChildren() method, to call all the "Updates()" of the children (also in an "ArrayList").
How can I call the Update() method of the subclass for every component in the ArrayList - and I do not think using casting& conditional statements will help. I can loop through the list, however, I do not know how to access the subclass methods without casting. Another possible error that I do not know how to solve, is to skip a component if there is no "Update()" method found(so it doesn't stop the entire program, but just skip the problem- and maybe just delete it from the list)