Public Section when creating a new c++ Class

When you create a new C++ class it comes up with two separate “public” sections in the header file. Why is that? Do they do different things or is it just the way its been set up where it is expecting us to put separate things in each one?

Public, Private, and Protected.

Each on has a different affect. When it comes to your code whatever you define as a function or variable you place in either one. BeginPlay() is often in Protected as it will be used in multiple c++ classes so it stops other c++ classes from changing the function.

Private function and variables will only be allowed to be found in your specific c++ class.

Public allows your functions and variables to be called in other c++ classes as long as you define them and/or include them at the top of either your header or cpp files.

Privacy & Terms