[plt-scheme] About "interface" in MzScheme
Hi All,
I'm new to MzScheme and feel exciting
about the OO system =).
However, I wonder what's the "interface"
for? In Java/C++ interfaces or classes with
pure abstract methods are used as place holder
for real implementation of methods. However,
in Scheme you do not even need to worry about
types when you create variables to hold the
object.
e.g.
In Java:
public interface MyInterface {
public void doIt();
...
}
public class MyClass implement MyInterface {
public void doIt();
...
}
public class OtherClass {
public void go(MyInterface mi) {
// so we are sure "mi" have "doIt()"
mi.doIt();
}
}
In Scheme:
// no need to declare type for "obj"
(define obj (make-object MyClass%))
So why do you need interfaces?
Are there any more detailed tutorial to
OO system of MzScheme besides the Manual?
Regards,
Oscar
-----------------------------------------------------------------
< 每天都 Yahoo!奇摩 > www.yahoo.com.tw