Object ancestor := method (
prototype := self proto
if (prototype != Obejct,
writeln ("Slots of ",
prototype type,
"\n------------------"
)
prototype slotNames foreach (slotName,
writeln (slotName)
)
writeln prototype ancestors
)
)
 unless := method (
(
call sender doMessage (
call message argAt(0)
)
)
ifFalse (
call sender doMessage (
call message argAt(1)
)
)
ifTrue (
call sender doMessage (
call message argAt(2)
)
)
)

 Animals.io

    Object ancestors := method (
prototype := self proto
if (prototype != Object,
writeln ("Slots of ",
prototype type,
"\n----------------"
)
prototype slotNames foreach (
slotName,
writeln (sloteName)
)
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

 

Io_Language的更多相关文章

随机推荐

  1. 转载爱哥自定义View系列--Canvas详解

    上面所罗列出来的各种drawXXX方法就是Canvas中定义好的能画什么的方法(drawPaint除外),除了各种基本型比如矩形圆形椭圆直曲线外Canvas也能直接让我们绘制各种图片以及颜色等等,但是 ...

  2. [HDU 4433]locker[DP]

    题意: 给出密码做的现状和密码, 每次可以移动连续的最多3列, 向上或向下, 求将密码调出来所需要的最少步数. 思路: 首先应看出,恢复的过程中, 调每一位的时间顺序是不影响的, 不妨就从左到右一位位 ...

  3. Drawable(3)Color State List Resource

    注意 Color State List Resource 与 Color不同,前者是颜色状态表.根据不同状态显示不同颜色,它是State list,里面有多种颜色,后者只是一个颜色. Color St ...

  4. 关于mIdleHandlers 空闲消息

    模拟情况说明 创建一个handler对象 该handler持有的是主线程 1.先发送一个延时20秒的message what=35;2.紧接着又发送一个延时10秒的Runnable3.在该Runnab ...

  5. Virtual member call in a constructor

    http://stackoverflow.com/questions/119506/virtual-member-call-in-a-constructor (Assuming you're writ ...

  6. poj棋盘分割(记忆化)

    http://poj.org/problem?id=1191 黑书上P116 想了挺久 没想出来 想推出一公式来着 退不出来.. 想偏了  正解:递归 #include <iostream> ...

  7. BZOJ_3039_玉蟾宫_(动态规划+悬线法)

    描述 http://www.lydsy.com/JudgeOnline/problem.php?id=3039 n*m的矩阵由R和F组成,求全是F的子矩阵的大小的三倍. 分析 悬线法: 浅谈用极大化思 ...

  8. The Donkey of Gui Zhou

    Problem Description There was no donkey in the province of Gui Zhou, China. A trouble maker shipped ...

  9. 【原】1.1RDD源码解读(二)

    (6)transformation 操作,通过外在的不同RDD表现形式来达到内部数据的处理过程.这类操作并不会触发作业的执行,也常被称为lazy操作. 大部分操作会生成并返回一个新的RDD,例sort ...

  10. HW3.9

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...