Skip to content

Instantly share code, notes, and snippets.

@atilaneves
Last active August 8, 2018 11:48
Show Gist options
  • Save atilaneves/b69ed0399efac21bb7a977afdfedee8f to your computer and use it in GitHub Desktop.
Save atilaneves/b69ed0399efac21bb7a977afdfedee8f to your computer and use it in GitHub Desktop.
betterC classes
extern(C++) class Foo {
void stuff() {
import core.stdc.stdio;
printf("I'm foo!\n");
}
}
extern(C++) class Bar: Foo {
override void stuff() {
import core.stdc.stdio;
printf("I'm bar!\n");
}
}
extern(C) void main() {
Foo foo;
assert(foo is null);
scope obj = new Bar;
obj.stuff;
foo = obj;
foo.stuff;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment