I was wondering about why when you add a new C++ class, you get the choices of putting your class in a Public/Private or none at all, just include it in a solution.
I understand the concept of OOP public and private keywords. Private would make it unaccessible like a property or a method outside the class. But what’s the point of having a private class? And what would you put as a private class in the folder?
It’s also worth noting that getters and setters should only be created for things you actually expect to be accessed. A lot of people fall into the bad habit of creating getters/setters for everything when they first learn about them.
When you type MyClass::… you should see an intellisense drop-down that effectively tells someone everything they need to know about how to use your class. It’s a good habit to use this list to keep your class light and relevant.
Indeed, as I said I’m aware of the OOP principles of why should a variable be private and needs a getter and setter. But what I’m trying to ask is why when you make a class via Add C++ code via the Editor you can choose to put it either in Public or Private folder
Public means the class will be exported and accessible from outside its Module. Private means it is only accessible from within the Module its defined in.