Creating Objects using strings

"Luke Young" <[email protected]> Tue, 12 Aug 2003 13:40:23 -0000
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <[email protected]>
The problem:

I want to create an object of a class that has its class name stored
as a string.

Currently I do this by using

initialization
  RegisterClass(TMyClassName);

and then in the routine I use

tmpClass := FindClass(strClass);
tmpObject := TControlClass(tmpClass).Create(Self); { All classes are
TControlClass based }

Is there a better way of doing this? I am wondering if Registering the
class has any penalty? or is this the way to go?

Cheers

Luke


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/