Skip to content

Commit a276f0c

Browse files
committed
Update README
1 parent c99f35c commit a276f0c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,29 @@ and should eventually be pushed upstream to tclconfig/sampleextension located he
88
* https://core.tcl-lang.org/tclconfig
99

1010
I don't plan long-term maintenance once the porting is done (started in July 2021)
11+
12+
This example demonstrates a simple animal class (see `generic/sample.hpp` and `generic/sample.cpp`).
13+
Below is a transcript from using the library:
14+
15+
(sampleextension-cpp) 49 % load ./libsample0.5.dylib
16+
(sampleextension-cpp) 50 % ::sample::Animal chris dog 5
17+
_f0c9461fdd7f0000_p_Animal
18+
(sampleextension-cpp) 51 % chris describe
19+
I am a dog and I am 5 years old
20+
(sampleextension-cpp) 52 % chris birthday
21+
6
22+
(sampleextension-cpp) 53 % chris birthday
23+
7
24+
(sampleextension-cpp) 53 % chris describe
25+
I am a dog and I am 7 years old
26+
(sampleextension-cpp) 54 % chris cget -type
27+
dog
28+
(sampleextension-cpp) 55 % chris cget -age
29+
7
30+
(sampleextension-cpp) 56 % chris configure -type cat
31+
(sampleextension-cpp) 57 % chris describe
32+
I am a cat and I am 7 years old
33+
(sampleextension-cpp) 58 % chris -delete
34+
(sampleextension-cpp) 59 % ::sample::Animal chris dog -3
35+
RuntimeError Age cannot be negative!
36+
(sampleextension-cpp) 60 %

0 commit comments

Comments
 (0)