Getting a class' name, but not fully qualified?
JR
zorael at gmail.com
Thu Mar 27 03:01:39 PDT 2014
On Thursday, 27 March 2014 at 06:16:04 UTC, Jeremy DeHaan wrote:
> As the title says, I was wondering if there was a way to get
> the classes name at runtime, but not its fully qualified name.
> I want JUST the name of the class only.
So for a given class Foo, you want to extract the string "Foo"?
class Foo
{
unittest() {
assert(typeof(this).stringof == "Foo");
}
}
If that gets evaluated in runtime I guess you could store it in
an enum.
More information about the Digitalmars-d-learn
mailing list