Reference object instance created using "with" in Delphi -


Is there a way to refer to the object instance created using "statement" with a "?"

Example:

  Start with TAnObject.Create DoSomething (example); End;  

Where anything will use the context of the example as if you were going through an object object referencing variable for the object.

Example:

  AnObject: = TAnObject.Create;  

Thanks.

OK, you can use this approach:

// Implementation: type TSimpleMethod = the process of the object; Function GetThis (CRR: TSimpleMethod): TOBject; Start the result: = TMFT (PR). Data; End; // Usage: Try CommaText with TStringList.Create: = '1,2,3,4,5,6,7,8,9,0'; ShowText (TStringList (GetThis (free))); finally free; End;

or class assistant:

  type TOBjectHelper = class accessory toggle for private function GetThis: TOBject; In line; Public property: Read TOBject GetThis; End; ... TOBjectHelper.Get this function: TOBject; Start the result: = self; End;  

But, in fact, the last answer is correct: you should better remember the "with" statement.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -