Best way to operate unknown type objects?
889039Sep 19 2011 — edited Sep 21 2011Hello,
I have 3 types of class:
A, B and C.
A is my created object containing few int and String fields. B extends A. And C extends B. Also A have int type field which defines its type.(A, B or C).
I can put them in to ArrayList<.A> or HashMap<.A> using int as key and later correctly retrieve using println method.
I would like to ask you what is the right way operating with those object if I don't know what type will be returned.
That means that type of variable use to store and operate retuned object.
I would be grateful for your help.