typeid of surrounding class from a static function?
Alex Rønne Petersen
xtzgzorex at gmail.com
Sun Nov 6 09:14:20 PST 2011
On 06-11-2011 14:34, J Arrizza wrote:
> Hi,
>
> I'm trying to get the name of the surrounding class from within a static
> method of the class:
>
> import std.stdio;
>
> void main(string[] args)
> {
> auto o = new SomeClass();
> o.Run();
> SomeClass.StaticRun();
> }
>
> class SomeClass
> {
> public void Run()
> {
> writeln("In Class non-static: ", typeid(typeof(this)));
> }
> public static void StaticRun()
> {
> writeln("In Class static: ", typeid(typeof(??)));
> }
> }
>
>
> What do I use for "??" above.
>
> John
Considering the class is statically known, typeid(SomeClass)?
- Alex
More information about the Digitalmars-d
mailing list