What's the difference between casting using (Object as TClass) and TClass(Object)

Posted by Peter Turner on Stack Overflow See other posts from Stack Overflow or by Peter Turner
Published on 2010-03-15T19:18:03Z Indexed on 2010/03/15 19:29 UTC
Read the original article Hit count: 249

Got an issue where MyObj.classnameis(TMyClass.classname) is true and TMyClass(MyObj) works but (MyObj as TMyclass).doSomething throws a conversion error.

I don't really want any help with that junk, although if you want to put it in the comments that'd be super. I just would like to know what the difference between Obj As Class and Class(Obj) is.

© Stack Overflow or respective owner

Related posts about delphi

Related posts about typecasting