Last active
August 8, 2018 11:48
-
-
Save atilaneves/b69ed0399efac21bb7a977afdfedee8f to your computer and use it in GitHub Desktop.
betterC classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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