What IS true is that you can change the properties of S, even if it is
passed by value or as const. But the pointer S cannot be changed.
I desired to change the pointer; manifestly I have to pass it as var.
Be aware that if you do this, you will lose the ability to pass any class
that
2006/7/13, memsom [EMAIL PROTECTED]:
Be aware that if you do this, you will lose the ability to pass any class
that descends from the param type. Var params have to be the smae type
exactly. The Delphi compiler will halt on an error if the exact type isn't
used (though, thinking about it, the
I tried the following:
procedure ThisAndThat(bitmap: TBitmap);
begin
if not Assigned(bitmap) then
bitmap := TBitmap.Create;
end;
function Test: boolean;
var
bitmap: TBitmap;
begin
bitmap := nil;
ThisAndThat(bitmap);
Result := Assigned(bitmap);
bitmap.Free;
end;
In Delphi a class is
On Wed, 12 Jul 2006, Alexandre Leclerc wrote:
I tried the following:
procedure ThisAndThat(bitmap: TBitmap);
begin
if not Assigned(bitmap) then
bitmap := TBitmap.Create;
end;
function Test: boolean;
var
bitmap: TBitmap;
begin
bitmap := nil;
ThisAndThat(bitmap);
Result := Assigned(bitmap);
On 7/12/06, Alexandre Leclerc [EMAIL PROTECTED] wrote:
In Delphi a class is always treated as a 'var' when passed in a
function since a class is a pointer to actual data;
No, not really. It is always passed as a pointer, but here you want to
change the pointer and not the contents of the
2006/7/12, Michael Van Canneyt [EMAIL PROTECTED]:
Ahem.
Have you tried that ? Because it is manifestly NOT true:
Ah! I learnd something today! You are completly correct:
What IS true is that you can change the properties of S, even if it is
passed by value or as const. But the pointer S
2006/7/12, Felipe Monteiro de Carvalho [EMAIL PROTECTED]:
On 7/12/06, Alexandre Leclerc [EMAIL PROTECTED] wrote:
In Delphi a class is always treated as a 'var' when passed in a
function since a class is a pointer to actual data;
No, not really. It is always passed as a pointer, but here you