|
| From: | Jose E. Marchesi |
| Subject: | Re: [RFC] Methods and functions |
| Date: | Mon, 04 May 2020 23:38:17 +0200 |
| User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> 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?
Yep. That was a typo :)
| [Prev in Thread] | Current Thread | [Next in Thread] |