Private section for Overrides


In C#, the compiler will complain is we override a class with the wrong Access Modifier for the method we are overriding. it seems not that important in C++. I guess you could decide to change the access modifier for a method maybe? I can’t see when this can be a good idea though…

In the lecture i’m at, we can see in the header file:

  virtual void BeginPlay() override;

I don’t really understand how this works. BeginPlay() must be called from the UEngine, so it cannot be private?
Also, Ben often puts the virtual keyword in a private override. My understanding is that a private method cannot be overriden? Shouldn’t that be in the protected section instead?

I hope there a lecture that delve deeper on that topic.

It’s not invalid code but kind of bad design, there should be an annotation in the lecture to say to keep the accesser the same. So protected.

Privacy & Terms