Trying to override base class methods, getting error C3668
I was following survival sample game tutorial about Sprinting and sharing it to all clients. And I am trying to use same method for my character but trying to put combat mode on
I use parent character to define all inputs and put the combat mode on and then im using Base character to set it on to other clients.
The problem is that this
should override this
but when trying to compile it says this error
here is my both characters classes
parent character .h
parent character .cpp
and Base character .h
base character .cpp
Thanks for help
asked Sep 21 '16 at 11:17 PM in C++ Programming
Did you specify that your AFpCharacter inherit from ABaseFpCharacter ?
answered Sep 22 '16 at 05:33 AM
It's tough to see what's going on without the full contents of the source files. You say you want AFpCharacter to be the "parent", but if it's the parent then ABaseFpCharacter should be overriding its methods, not the other way around. Do you mean that AFpCharacter is supposed to be the child?
If this is the full content of the source files, there's a number of problems here. Without the class declarations there's no tie into your API, UE4 macros, or Blueprints (if you want access to them in Blueprints); on top of the fact that you're not actually creating a new class.
Your method definition in the FpCharacter.h file is declaring an empty method within the header; you can place it here, but you probably just want a semi-colon (;) after "override" and to place the body of the function (assuming there is one) in the .cpp file.
Should look more like this:
If you want your class to be available in Blueprint you'll want to include "Blueprintable" and "BlueprintType" in your UCLASS macro:
Your FpCharacter.cpp file should go from this:
Similarly, your BaseFpCharacter needs a class declaration, macros etc. I'm assuming you want to inherit from ACharacter, but you could also use APawn or AActor
Then your BaseFpCharacter.cpp fill will need to include the constructor:
answered Sep 22 '16 at 08:23 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here