You cannot safe-cast a pointer. This will fail:
ptr as TProjectYou can only cast pointers the unsafe way:
TProject(ptr)That is, unless you use this neat trick:
TObject(ptr) as TProjectThis will also catch programming errors, specifically a pointer that doesn’t point to an object.