yes, you can use self as a local temporary variable, even if it is useless here. But in this case, the stream object must be the same class as self (TMyObject), or the compiler will detect an error because the type is not compatible .
In your example TSomeObjectStreamer.ReadObjectFromFile(), TMyObject should return, or your compielr should warn you (or throw an error)
source
share