[ franjo_tahi @ 01.04.2011. 14:40 ] @
Može li mi tko objasniti sljedeće ponašanje:

Definirano je:
Code:

tRec1=record
      fTopLeft, fTopRight, fBottomLeft, fBottomRight: TPoint;
end;

tKlas1=class
  ...
  private
     fRec = tRec1;
  public
     property Rec: tRec1 read fRec write fRec;
end;

tKlas2=class
   ...
   private
     fKlas1: tKlas1;
   public
     property Klas1: tKlas1 read fKlas1 write fKlas1;
end;

Podacima iz recorda tRec1 pristupam samo iz klase. Objekti su definirani, da ne kopiram kod... ono što javlja grešku:
Ako pokušam:
Code:

   Klas1.Rec.fTopLeft := 0;

compiler javi grešku: Left side cannot be assigned to

Ako pokušam:
Code:

   Klas1.fRec.fTopLeft := 0;

sve je ok.

[ savkic @ 01.04.2011. 16:21 ] @
> Klas1.Rec.fTopLeft := 0;
> compiler javi grešku: Left side cannot be assigned to

Možeš dodeliti čitav property (record) ali ne i pojedine članove, dakle možeš napisati Klasa1.Rec := ARect;

> Klas1.fRec.fTopLeft := 0;

Ti ovde preskačeš property i dodeljuješ direktno vrednost polju klase.