As a container, TList stores all its items as a TObject wrapped in some additional information for indexing. If I have a TList of items from various classes, is it possible to find out the class of each item? For example,
TString* foo = "I'm a string";
TNtuple* bar = new TNtuple();
TList myList = new TList();
myList->Add(foo);
myList->Add(bar);
TIter next(myList);
TObject* obj;
while (obj = next())
{
if (obj->WasATString())
{
std::cout << (TString) (*obj) << "\n"; // what replaces WasATString()?
}
}
Ideally this code goes through myList and picks out only the objects of a certain type. Is there a way to do that?