What public and private mean on C++ wizard?

We just put all our code in public. The one nice benefit of header in “public”, it is easier include them since you don’t need to include their directory path. For example, if you have a header in:

“Source/Game/Public/SubFolder/AnotherSubFolder/HeaderYouWantToInclude.h”

Instead of having to:


#include "SubFolder/AnotherSubFolder/HeaderYouWantToInclude.h"

You can just:


#include "HeaderYouWantToInclude.h"

No offsets, subfolders, etc. MUCH easier to move code files.

1 Like