Inherited member is not allowed

I am trying to move from blueprints into c++ and have been rolling through the tutorials. I’ve been able to work through some of the misstatements and small outdated things, but for the life of me I can’t figure out the error with this block:

void AMyActor::PostInitProperties() // error here with 'PostInitProperties()
{                                    // Error: inherited member is not allowed
	Super::PostInitProperties();
	DamagePerSecond = TotalDamage / DamageTimeInSeconds;
}

I have a basic understanding of inheritance, but I can’t seem to figure out where this goes. Everything works without it no problem. I’ve searched for answers and scrounged the documentation, but can’t quite wrap my head around where it needs to go.

Can you show declaration of that function in header file?

The page here:
https://docs.unrealengine.com/latest/INT/Programming/Introduction/index.html

Doesn’t talk about that so I tried a couple different ways matching what was already there, but couldn’t get it error free.

Using what you said made me realize my mistake. I did a simple:

virtual void PostInitProperties();

In the header. I am facepalming so hard. Thanks either way.

Ok so i convert my comment to answer :slight_smile:

Imgur

I am so confused. Glitches. Glitches everywhere today. Bugs are plentiful.

If you wouldn’t mind, could you explain to me how you fixed it? I’m fairly new to coding but I am really eager to learn.

Sure! I will start with my problem that I had. There is a class in the UE4 source code pre made with default values I want to call to do a specific job. I put the call in my source file, but it errors because it can’t see it. I have to copy the class somewhere for it to use, which is why I got the error. By putting ‘virtual void PostInitProperties();’ in my header under ‘public:’, it’s like making an object of the class for my actor to use exclusively that I can then call and reference with ‘super’ to my every need. It’s more complicated than that, but that’s the just of it. I’m still learning and getting my hands dirty, but this is object orientation and inheritance.

I know this reply is late but I want to thank you so much man, you helped me out a ton and saved whatever hair is left on my head.

No worries, just pop me an email if have anymore questions. bleudeveloper@gmail.com
I’m still learning this stuff too :slight_smile:

Add this to the header file

virtual void PostInitProperties() override;
1 Like

Is this for 4.8?

Why are you asking? This should be the normal syntax to override a virtual function of a base class :X

There can be several different ways to do the same thing, and their codebase is constantly evolving as is their standards, so I hadn’t looked at that specific case in a long while as I have been dealing mostly with blueprints while I’m prototyping. Given I now realize what you mean I apologize, but it can work without that as well.

Putting virtual void PostInitProperties(); directly under public: is the difference between this solution working and not working. Thanks for clarifying!

Are you still here?