15.11.2011 14:00, Graeme Geldenhuys пишет:
This one confused me a bit. I thought the whole object would be
read-only, but in fact it is just the AClass instance pointer which
cannot be modified. The properties of AClass are still read-write.
Perhaps it will be good to add support for const
On Tuesday 15 November 2011 11.00:34 Graeme Geldenhuys wrote:
> >> procedure foo(const AClass: TStringList);
> >
> > Take a copy of the AClass instance pointer, AClass is readonly.
>
> This one confused me a bit. I thought the whole object would be
> read-only, but in fact it is just the AClass
On 15/11/2011, Martin Schreiber wrote:
>
Thanks Martin. Extending my example by changing the body of foo() too...
AClass.Free;
AClass := TStringList.Create;
AClass.Add('inside foo');
...reveals a bit more about the differences.
>> procedure foo(const AClass: TStringList);
>>
> Take a c
On Tuesday 15 November 2011 10.33:13 Graeme Geldenhuys wrote:
> Hi,
>
> What exactly is the difference (if any) between the parameter modifier
> when you pass a class instance to a procedure?
>
> In the example below, I can define foo() as follows...
>
> procedure foo(AClass: TStringList);
> o
On Tue, 15 Nov 2011, Graeme Geldenhuys wrote:
Hi,
What exactly is the difference (if any) between the parameter modifier
when you pass a class instance to a procedure?
It behaves exactly the same as if you would pass a typed pointer.
Michael.
___
15.11.2011 13:33, Graeme Geldenhuys пишет:
Hi,
What exactly is the difference (if any) between the parameter modifier
when you pass a class instance to a procedure?
I your example there is no difference, except that "var" could be ~0.01%
slower
_
Hi,
What exactly is the difference (if any) between the parameter modifier
when you pass a class instance to a procedure?
In the example below, I can define foo() as follows...
procedure foo(AClass: TStringList);
or
procedure foo(var AClass: TStringList);
or
procedure foo(const AClass: TStri