There are a number of ways to achieve what you are talking about. Interfaces, delegates, reference caching, and runtime iteration of objects are all options, but the best approach(s) is highly project dependent. I think the video in the link I posted above will really help you understand better than anything I can type here.
Best,
Jonathan Lambert