[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] Methods and functions
From: |
Dan Čermák |
Subject: |
Re: [RFC] Methods and functions |
Date: |
Mon, 04 May 2020 23:34:47 +0200 |
"Jose E. Marchesi" <address@hidden> writes:
> It is also possible to define methods that modify the contents of struct
> fields, no problemo:
>
> defvar packet_special = 0xff;
>
> deftype Packet =
> struct
> {
> byte magic = 0xab;
> byte size;
> [...]
>
> method set_size = (byte s) void:
> {
> if (s == 0)
> size = packet_special;
> else
> size = s;
> }
> };
>
> This is what is commonly known as a "getter".
Isn't this a setter?