change object class
Christian Köstlin
christian.koestlin at gmail.com
Sat Sep 23 06:53:11 UTC 2023
On 23.09.23 05:25, Vitaliy Fadeev wrote:
> 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!
Here a solution with less `new`s: https://run.dlang.io/is/iV1qVq.
It really depends on the program that you are doing if creating those
news is a problem.
Kind regards,
Christian
More information about the Digitalmars-d-learn
mailing list