summaryrefslogtreecommitdiffstats
path: root/tcllib/modules/oometa/oometa.demo
blob: 302001f64258f8aa302d06ada5e8306dd3a37c74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
source ../dicttool/dicttool.tcl
source oometa.tcl

oo::class create animal {
  meta set biodata animal: 1
}
oo::class create mammal {
  superclass animal
  meta set biodata mammal: 1
}
oo::class create cat {
  superclass mammal
  meta set biodata diet: carnivore
}

cat create felix
puts [felix meta get biodata]

felix meta set biodata likes: {birds mice}
puts [felix meta get biodata]

mammal meta set biodata metabolism: warm-blooded
puts [felix meta get biodata]

# Overwrite class info
felix meta set biodata mammal: yes
puts [felix meta get biodata]