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 BasicAquaticSquid, BasicLandSquid, AdvancedAquaticSquid, AdvancedLandSquid like this:

I think that's called the Abstract Factory method? It seems very tedious though. Any better way of doing so?


You are viewing a single comment. View All
Answered by xxpertHacker [earned 5 cycles]
View Answer

@DynamicSquid Whoa whoa, you need to learn the language.
Once you have, you'll realize C++ is the language without restriction and with weird rules. Rust is a language that makes sense.

Also, it has one major advantage over C++: there is no undefined behavior whatsoever.

You can have a multi-threaded program, knowing everything will always run flawlessly (okay, it might deadlock, but still).

You will never run into concurrent reading/writing problems.

You should never get a system floating-point exception.
Arithmetic should never overflow and give weird results.

You can't perform certain operations in Rust, but you can in C++:

You can't read uninitialized data:

You can't read out of bounds memory.

You get where I'm going, the list continues, you can't do a bunch of dumb stuff, do you know what that means?
Every package you import and use should work correctly, without having to review the code.

It doesn't have classes, so if you like OOP styled code, you'll have to learn how to write idiomatic Rust.