rust/src/test/compile-fail/class-method-missing.rs
Tim Chevalier 5c12cd72f4 Allow classes to implement ifaces
Introduce syntax like:

iface animal { ... }
class cat implements animal { ... }

to allow classes to implement ifaces. Casting classes to ifaces
is *not* yet supported. ifaces that a class implements are not
yet included in metadata.

The syntax is subject to change, and may go away completely if we
decide to use duck typing to relate classes with ifaces (see
http://smallcultfollowing.com/babysteps/blog/2012/04/10/declared-vs-duckish-typing/ )
2012-04-11 16:20:01 -07:00

13 lines
197 B
Rust

// error-pattern:missing method `eat`
iface animal {
fn eat();
}
class cat implements animal {
let meows: uint;
new(in_x : uint) { self.meows = in_x; }
}
fn main() {
let nyan = cat(0u);
}