Possible Duplicate:
How do you know when to use design patterns?
How can I understand/take decision about "When to use what Design Pattern"?
What are the factors to observe while taking decisions about using an appropriate design pattern in an appropriate place?
To avoid the problem of duplicated bugs, never reuse code by copying and pasting existing code fragments. Instead, put it in a method if it is not already in one, so that you can call it the second time that you need it.
because it goes against Composition over inheritance principle, will force any GameObject who needs to jump to inherit from Character class. This will make the design less flexible.
The conventional approach to reduce this kind of code duplication is to move the common code to a member function, which can be called from all the constructors. Usually, that member function is called init.
Generally, if you're doing it right, there's a pattern for it. You just might now know you're using it.
If you're doing it wrong, there's an anti-pattern for it. But you definitely don't know you're using it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With