Casting with a Hashtable
Hi all.
I´ve a problem. I´ve a hashTable that contains some objects. This objects aren´t of the same class, have different types.
When I get an object:
myObject = hashTable ["myKey"];
the type of myObject is "Object". This way I cant invoke myObject´s methods.
myObject.sayHello() -> Compile Error!
I have to cast myObject to (myClass);
myObject = (myClass) hashTable ["myKey"];
but I dont know what is myClass at compiling time.
Can I do somethig similar to?:
myObject = (myObject.getType()) hashTable ["myKey"];
Sorry, but my english is too poor. And Thanks!!!
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

shimtannyRank #3,312 · 434 pointsPosted Mar 23, 2005, 8:40 PM EST
spgilmoreRank #1,616 · 964 pointsPosted Mar 25, 2005, 9:03 AM EST