Skip to content

Instantly share code, notes, and snippets.

@leotada
Created July 16, 2018 14:40
Show Gist options
  • Save leotada/0c8c56af8358f1dee9b1830b118e8ed6 to your computer and use it in GitHub Desktop.
Save leotada/0c8c56af8358f1dee9b1830b118e8ed6 to your computer and use it in GitHub Desktop.
Check parent on inheritance - Dlang - D language
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