Skip to content

Commit c9dd91c

Browse files
committed
improved abstract object example
1 parent 2c43fb9 commit c9dd91c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

doc/spin.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,15 +543,16 @@ the value of `A#PIN_I2C` is the default for the mypins object, but the value of
543543
The proposed Spin2 syntax for abstract object definitions and object pointers is accepted by flexspin, even in Spin1 mode. A declaration like:
544544
```
545545
OBJ
546-
fds = "FullDuplexSerial"
546+
theser : "FullDuplexSerial" ' theser is a normal, concrete object
547+
fds = "FullDuplexSerial" ' fds is abstract
547548
```
548549
declares `fds` as having the methods of a FullDuplexSerial object, but without any actual variable or storage being instantiated. Symbols declared this way may be used to cast parameters to an object type, for example:
549550
```
550551
PUB print(f, c)
551552
fds[f].dec(c)
552553

553554
PUB doprint22
554-
print(@aFullDuplexSerialObj, 22)
555+
print(@theser, 22)
555556
```
556557
557558
### Object structures

0 commit comments

Comments
 (0)