Factory pattern for classes

Steven Schveighoffer schveiguy at gmail.com
Sun Aug 9 16:00:20 UTC 2020


On 8/9/20 10:58 AM, lexxn wrote:
> On Sunday, 9 August 2020 at 12:24:05 UTC, Steven Schveighoffer wrote:
>>
>> If you know what your class is going to be, I'd just import the file 
>> that contains it and avoid the whole Object.factory deal. It's going 
>> to go away anyways.
> 
> Not sure if it's a good idea in my case. I'm going to be using all of 
> the classes eventually in my loop, but I just need to initialize them in 
> a conditional way depending on the use case.

My point is -- it's a good idea to not use Object.factory, because it's 
going to go away.

It doesn't work in all cases anyway.

-Steve


More information about the Digitalmars-d-learn mailing list