Inc( ) en Dec( ) functies

private
fInteger:Integer;

public
getal:integer read fInteger write fInteger;
...

begin
  Inc(getal);
end;

[Error] Unit1.pas(44): E2064 Left side cannot be assigned to

Waarom is het niet mogelijk om een integere property te verhogen of verlagen door middel van de standaard procedures Inc() en Dec().

Dit komt doordat deze functies geoptimaliseerde code produceren bij compilatie voor het verhogen van een getal. Propertys daarintegen zijn een manier voor luie programmeurs om minder code te schrijven.
Compiletime worden propertys zoals getal := 10; omgeschreven naar pseudocode met onzichtbare get/set functies.
Dus als we iets doen als Inc(getal) dan zal het omgeschreven worden naar pseudocode "set := get + 1"; vanwege het optimaliserende karakter van Inc/Dec() is deze omschrijving niet mogelijk.

Oplossing: schrijf gewoon "property := property + 1" :-)

Commentaar van anderen:
lkm op 12-8-2010 om 8:07
But the growthwedding gown of supermarket wedding gownchains, the emergence Cheap Wedding Dressof the local foodCheap Simple Wedding Dressesmovement — New Cheap Designer Wedding DressesHampshire has more Wedding Dress Storesthan 80 farmers markets — and the grueling routine took a toll.
ChristianLouboutin op 16-8-2010 om 4:51
Christian Louboutin Shoes, Christian Louboutin, Christian Louboutin Shoes, Wedding Shoes, Christian Louboutin comfortable shoes are women best resolution Whoever you, Drafted this think you can expect to take pleasure in Christian Louboutin Shoes, Wedding Shoes, Christian Louboutin, Christian Louboutin Shoes. This sneakers experience women charm additionally sexy. Wedding Shoes, Discount Christian Louboutin, Christian, Louboutin, Christian Louboutin Sale This is usually fantastic Louboutin Shoes, Louboutin Sale, Cheap Christian Louboutin, Christian Louboutin Discount, Christian Louboutin Boots. As a result exist to help opt designed for style, you cherish it is usually to help opt in order for most of the eye-catching Christian Louboutin Pumps, Christian Louboutin Sandals, Christian Louboutin Flats, Christian Louboutin Evening, Christian Louboutin Wedges taht can acquire inspiration designed for his fatal stiletto investigation connected with an incident that will occurred as part of his the beginning of the twenties. Christian Louboutin Pumps, Christian Louboutin Boots, Christian Louboutin Sandals, Christian Louboutin Flats, Manolo Blahnik Shoes He visited a museum and furthermore, saw a warning that will forbade women in order to really act, Yves Saint Laurent Shoes, Yves Saint Laurent Boots, YSL Shoes, Miu Miu Shoes during bearing stilettos ready, fearing damage in order to this extensive wood floors. Herve Leger V Neck Dress, Herve Leger Bandage Dress, Herve Leger Dress, Herve Leger V Neck Dress This image stayed in their head, along with he used this idea later in his louboutin shoes.
Geef feedback:

CAPTCHA image
Vul de bovenstaande code hieronder in
Verzend Commentaar