What public and private mean on C++ wizard?

There is a reason to use public and private folders. Using public exposes it. Using private hides it. There should be no reason code files that are not used in a public manner to be in the public folder. Just like you don’t make things public you don’t want exposed in c++ itself.

The public/private structure is important to learn and know. Granted it doesn’t change much for a project implementation. but for plugin modules, this matters immensely. In fact, allot of code people put in their game prj, should be made into a plugin module with logical private/public top level folders.

Since UE4 is an API it makes sense to make and use plugins and let your game use those plugins. It also makes sense to dictate what files go in what folder because not only does it simplify your include statements significantly, but it also is much much cleaner directory structure and helps you keep a mental model of large amounts of code. The most important part is that it will help indicate what files are interface vs implementation.

This is a very popular type of folder structure. Every place I’ve consulted and worked with uses this structure.

Edit i should say that this private folder are not special they are just folder name, you can use any name you want… Though, from what i learned public is a special folder name.

5 Likes