summaryrefslogtreecommitdiff
path: root/io/animals.io
diff options
context:
space:
mode:
authorGuillermo Ramos2012-04-02 20:48:33 +0200
committerGuillermo Ramos2012-04-02 20:48:33 +0200
commit8ae4691e677414843cf3a84d4327d303fe3e2f41 (patch)
tree6007373b702ece4100819606a82ecbae76ff1dd5 /io/animals.io
parentfdd1e7abacd96d9bd49c13b2ecfcfe897546acae (diff)
download7l-8ae4691e677414843cf3a84d4327d303fe3e2f41.tar.gz
[Io] Día 2
Diffstat (limited to 'io/animals.io')
-rw-r--r--io/animals.io19
1 files changed, 19 insertions, 0 deletions
diff --git a/io/animals.io b/io/animals.io
new file mode 100644
index 0000000..b1b1a55
--- /dev/null
+++ b/io/animals.io
@@ -0,0 +1,19 @@
+Object ancestors := method(
+ prototype := self proto
+ if (prototype != Object) then (
+ writeln("Slots of ", prototype type, "\n-------------")
+ prototype slotNames foreach(slotName, slotName println)
+ writeln
+ prototype ancestors
+ )
+)
+
+Animal := Object clone
+Animal speak := method("ambiguous animal noise" println)
+
+Duck := Animal clone
+Duck speak := method("quack" println)
+Duck walk := method("waddle" println)
+
+disco := Duck clone
+disco ancestors