change object class

Vitaliy Fadeev vital.fadeev at gmail.com
Sat Sep 23 03:25:15 UTC 2023


On Friday, 22 September 2023 at 19:50:17 UTC, Christian Köstlin 
wrote:
> On 17.09.23 17:05, Vitaliy Fadeev wrote:
>> Hi!
>> 
> You could model it oop style like this:
> https://run.dlang.io/is/MJb5Fk
> This solution might not be to your taste, as it involves 
> interfaces, and classes and objects and garbage (all the news) 
> ...
>
> another option could be to model your own VTable in a struct 
> like this:
> https://run.dlang.io/is/3LTjP5
>
> Kind regards,
> Christian

```Behavior``` is beautiful code!

But it contains a second ```new``` when ```Chip``` is created. 
One ```new``` is possible?

Christian, really nice code!

Does ```__vptr``` do the same thing ?



More information about the Digitalmars-d-learn mailing list