How to get the type of a derived class in a method of its base class?

aberba via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 19 01:11:15 PST 2017


On Sunday, 19 February 2017 at 07:52:13 UTC, Max Samukha wrote:

>
> class B {
> }
>
> auto b = new B;
>
> Here, T becomes A, which may be reasonable but is completely 
> useless. Is there a way to obtain the type of the class (or 
> class instance reference) the method is called on?

is B not supposed to inherit from A?
like

class B: A {}


More information about the Digitalmars-d-learn mailing list