Proper way to add custom logic

Hey everyone. My question is how am I suppose to go about adding my own custom C++/blueprint logic to objects in ue4? My confusion is explained better with an example. Say I want to create a character and so I go and inherit from ue4’s character class. After a bit I find I want to add additional functionality to the movement component. Now I could just create my own c++ movement component and add it to my derived character class. The problem is wouldn’t this be duplicating code since ue4’s character class already comes with a movement component? I do not want to add movement component logic within my base character class because, as good OO design goes, I do not want to give that class multiple responsibilities.

Instead, if I decide to inherit my character from say ue4’s pawn class, then I can add a custom movement component without worrying about duplicating code but then I wont get all the useful functions from ue4’s character class. Am I thinking about this the wrong way? Are there better ways to handle this? Any help is appreciated.

What useful UCharacter functions you mean? some are tied with UCharacterMovmentComponent so you either use it or not

Well to be honest I can’t really give specifics. I guess what I meant was the character class comes with a lot of functions and other components that are probably useful at some point. For example in UE4’s character class there is a capsule component that is setup within it’s constructor. If I were to inherit from pawn instead then I would have to setup my own capsule component, possibly messing up something with it’s setup.

My dilemma is I would still want some of the default components/functionality of the character class (the functionality that I don’t want to add custom code to) but also the ability to create my own components/functionality without duplicating code. If this is just not possible then that’s okay but I was curious if this was the case or if there was a better way to do things.

I would like to be able to just inherit from UE4’s character class and add custom components when needed but the more I would do that the greater the code duplication it seems.