Skip to content
loading...

re: How to avoid the Factory pattern in C# VIEW POST

FULL DISCUSSION
 

But, what if I'm building a Beagle and a German Shepherd?

I'd make sense to have two classes that build the same class Dog, but gives me a different ones, based on it's properties.

More code? You're right, but also much more readable.

 

I'm not sure I follow you. Are you saying that we could create Beagle and GermanShepherd as subclasses of Dog? That's true, but I don't see how that would change the situation much.

Can you clarify, or give an example where a factory class makes more sense than a function?

code of conduct - report abuse