Abstract type: Difference between revisions

Content added Content deleted
No edit summary
Line 413: Line 413:
class Foo {
class Foo {
// abstract methods can have an implementation for
// abstract methods can have an implementation for
// use in super calls
// use in super calls.
abstract void foo() {
abstract void foo() {
writeln("Test");
writeln("Test");
Line 420: Line 420:


interface Bar {
interface Bar {
// interface methods are implicitly abstract and cannot
// provide default implementations
void bar();
void bar();

// Final interface methods are allowed.
final int spam() { return 1; }
}
}


class Baz : Foo, Bar { // super class must come first
class Baz : Foo, Bar { // Super class must come first.
override void foo() {
override void foo() {
writefln("Meep");
writefln("Meep");