typeid of surrounding class from a static function?

Steven Schveighoffer schveiguy at yahoo.com
Mon Nov 7 04:24:39 PST 2011


On Sun, 06 Nov 2011 17:55:03 -0500, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 11/6/11 7:34 AM, J Arrizza wrote:
>> Hi,
>>
>> I'm trying to get the name of the surrounding class from within a static
>> method of the class:
>
> typeof(this) works inside static methods too.

More info:

http://www.d-programming-language.org/declaration.html#typeof

"typeof(this) will generate the type of what this would be in a non-static  
member function, even if not in a member function."

-Steve


More information about the Digitalmars-d mailing list