2011/7/28 Bernd <prof7...@googlemail.com>:
> And also maybe does some
> clever and elegant pattern exist that would enable me to simply reuse
> the instance of A (if an initialized object exists already on the left
> side of the assignment)

For example (pseudocode, not sure if this is allowed):

operator + (a,b: IBigNum):IBigNum;
begin
  if not assigned(Result) then
    Result := TBigNum.Create;
  BN_add(Result.BN, a.BN, b.BN);
end;

Am I allowed to access the Result in this way? I have done only a few
experiments and at one time it seemed I could indeed access values of
the fields of the object on the left side of the assignment through
the Result variable but I'm not sure whether this was only coincidence
or if this is actually allowed.

Bernd
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to