PDA

View Full Version : About TClassList



marmin
03-08-2008, 01:05 PM
Studying TClassList yesterday, thisd may be a stupid question. There's not much info to find on the net.
but how can I access and change a class in the list?



type
TTest = Class

//

end;

var
Test1 : TTest;
TestList : TClassList;



setup and creating items in the TClassList are OK.
But- items of TClassList are of TClass, so how can I f.e. assign test1 to an item of the list.

JSoftware
03-08-2008, 02:17 PM
You can't. TClass refers to a type. TClassList holds a list of types, not instances

masonwheeler
03-08-2008, 03:35 PM
It's a bit confusing at first. Basically, a TClass isn't an object, it's the object's type. It's a pointer to the RTTI for that class, and it's useful for a lot of high-level object-oriented work. If you want to put objects into a list, use a TObjectList.