© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
13 replies
Nectar

✅ Confused when try to implement Factory Method

I'm learning design patterns starting from the factory method. what I'm confused about is the first initialization to be used as a reference to be manipulated, for example as follows:

https://hastebin.com/share/kohugizayu.csharp

These 3 variables are needed for the movement (and maybe initialization) of the player later and it looks like it should be done in each concrete product, so where should I declare these 3 variables in the factory method implementation? if I declare it in each concrete product it will look like duplication code.

Any suggestions?

Thanks
Hastebin
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Factory method
C#CC# / help
16mo ago
✅ Factory Method Pattern
C#CC# / help
17mo ago
Design Patterns / Factory Method
C#CC# / help
17mo ago
❔ Factory Design method pattern
C#CC# / help
3y ago