Say the classes A1, A2, ..., An all extend the abstract class B. I would like A1, ..., An to have a function that returns a string of the class name. This is certainly known at compile time, but I would like to implement this function in B and use inheritance so that all Ai: s get this functionality.
In java, this is easy to do if B has a method
String getName() { return this.getClass(); }
More or less. So how do I do this in D? Also, is there a way, using traits or similar, to determine which members of the class are publicly available?
source share