Derived type

novice2 sorryno at em.ail
Tue Mar 30 19:33:31 UTC 2021


On Tuesday, 30 March 2021 at 19:12:29 UTC, Ali Çehreli wrote:
> "Derived type" is used in the context of object oriented 
> programming at least in D

Sorry, i use wrong termin.
I just want create new type Tnew, based on exist type Tbase.
Tnew have same allowed values, same properties, same allowed 
operations as Tbase.
Compiler should distinguish New from Tbase.
Allowed implicit cast Tnew to Tbase.
Prohibited implicit cast Tbase to Tnew.
Allowed exlicit cast Tbase to Tnew.


> but your examples indicate you need something else. How about 
> the 'alias this' feature?

Thanks, this is what i want.
I just think that Typedef do it for me, hide this boilerplait 
code.



More information about the Digitalmars-d-learn mailing list