What design pattern should I use for specific multiple inheritance?
Let's say I have an interface called Squid.
And we have a bunch of different types of squids:
Here's everything a squid can be:
How would I go about create an instance of a squid? Should I go about creating 4 classes
AdvancedLandSquid like this:
I think that's called the Abstract Factory method? It seems very tedious though. Any better way of doing so?
I feel like what should happen is (you forgot your semis, that bothered me a lot):
and you now see you could even make this only one class! Maybe even polymorphism idk
@CSharpIsGud Assuming you're talking about C# structs, that'll be worth keeping in the back of my mind, should I ever find myself debugging C# or learning the language.
Also, I presume the unnecessary
new is because they aren't heap allocated, is C#'s
new related to heap allocation at all?
@CSharpIsGud Well, of course, if a class instance is heap-allocated, then I would expect all of its members to be on the heap too, including structs.
But, since you're here, and you use OOP styled code (right?), you seem like you would be among the most capable programmers here capable of helping out @DynamicSquid with his question.