How to get child class Type and members from parent class?

zoujiaqing zoujiaqing at gmail.com
Thu Nov 21 08:23:27 UTC 2019


On Wednesday, 20 November 2019 at 22:26:17 UTC, Adam D. Ruppe 
wrote:
> On Wednesday, 20 November 2019 at 20:57:56 UTC, Matheus wrote:
>> This is a different way of designing things, do people use 
>> this often?
>
> This is really only useful sometimes.
>
> It is important to notice that if you do
>
> class C : I {}
>
> I c = new C();
> c.something();
>
>
> the template this there will show I, not C. All it means is 
> this is being called on an object of that *static* type. So it 
> isn't really a substitute for traditional virtual functions.
>
> Sometimes appropriate to use, just often not.

Thanks every friends :)


More information about the Digitalmars-d-learn mailing list