Created
July 16, 2018 14:40
-
-
Save leotada/0c8c56af8358f1dee9b1830b118e8ed6 to your computer and use it in GitHub Desktop.
Check parent on inheritance - Dlang - D language
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
module test; | |
import std.stdio; | |
import std.traits; | |
class A {} | |
class B : A { } | |
void main() { | |
alias Bases = BaseClassesTuple!B; | |
writeln(Bases.stringof); /* prints "(A, Object)" */ | |
static assert(Bases.length > 0); | |
alias T = Bases[0]; | |
auto t = new T; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment