❔ Better way of handling this?
Is there a better way of handling this? The objects all inherit from the same base abstract class which contains the HandleUpdate method. The syncMessage.type is a string and I don't think I can change that (not 100% sure)
It feels like the strategy pattern might be what I'm after but this implementation already uses 3 classes per object and I'd rather not add more. Any ideas?
Edit: Cleaned code up to remove information irrelevant to the question
4 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
if the type is a string and matches the actual type, you could try something like...
Or similar. It's not great, but might be the best you can do with that kind of input
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.