C++ source directory structure

I am going to start a medium size project, and I want to know what is the standard today in source directory structure. The ShooterGame example comes with the old Public / Private directory structure. Is that directory structure still used? What do you use for your new projects? What do you modify in the *.Build.cs? Do your classes always match with a .cpp and .h file?
Thanks

Is that directory structure still used?

As far as i know yes, only thing removed was “classes” directory, but you can still find those in engine source code. What is in Public is exposed to linking and can be used in other modules and potentially other programs if you think about security.

What do you modify in the *.Build.cs?

Build configuration of your module. Most things in VS are ignored and those files are actully one that sets configuration. I don’t think there much documentation, you need to look up UBT source code to see what you do here. Also modules in Unreal Engine source is also good source of knowledge on that, aspecially plug-ins

Do your classes always match with a .cpp and .h file?

They don’t need to except one case, if im not wrong if you have UObject class in header file it needs to be named after it, the cpp can be named differently or be even part of other cpp. I seen many UE4 classes in engine source that have header file for some class, but code it self is in some random cpp, i also seen class code segmented in to multiple cpp files.

Little bit extra off-topic

In C/C++ there no difference between c/cpp and h, both are C++ files. C and C++ compiles code per individual files and code need declarations all of things you gonna use and it will mark in object file (end product of compilation) information what later gonna be used in linking to link code from individual cpp files together and complete entire code. That why header files been made which you can #include them (this compiler command pastes file to file that it’s in, it does not even need to be header file, lot of people not aware of that) to cpp files so there no need copy and pasting same declarations over and over again and avoid massive duplication. Also because we don’t want to build same code twice header files usally contain only declarations. Header files have .h file extension so coder knows which file contains the code and which declarations which can be included in other files, this is also information for compiler to ignore those files as those don’t need to be compiled

So technically you can do anything as long everything you use is declared in the file, but in UE4 you got tool called UnrealHeaderTool which assumes that you make header files for each UObject class so it enforce conventions on the coder, but that can be ignored in non-UObject header files, UBT will build all cpp files found in module directory regardless

No body force you to follow those conventions but of corse, best would be if not play too much and try to make your game code in same conventions as rest of UE4 engine code is, so other coders won’t be confused. I just saying this to you so you understand how cpp and h files work in C++ overall and why they are divided