Well, they go in whatever you define them as. You use the keyword "public" for public, and "private" for private.
private:
1 2 3 4 5 6 7
//Private Var / Funcs
class CLASS{
private:
int var1;
void SuperFunc();
}
public:
1 2 3 4 5 6 7
//Public Var / Funcs
class CLASS{
public:
int var1;
void SuperFunc();
}
And I do like to make functions public, just for ease of use. But, I make variables protected, sometimes private depending on it's importance. Usually companies dislike it when you make variables public. I am pretty sure it is a security thing.
In javascript and C# (just telling you fun-facts / random info) you can do define the variable / function with the keyword, like static or const
Ex:
1 2
privateint var1; //This variable is private.
publicint var2; //This variable is public
Sorry, I didn't explain correctly. Public members can be used anywhere at anytime. Private members can only be used inside the class. Public can be used with any function, not just main, as long as you are programming correctly with objects. Think of it this way:
You are in elementary school, and the teacher has classroom supplies. You can use them anywhere in the room, but if you take it out of the room, you get an error (in trouble). But, her bookshelf has books you can sign out and take anywhere in the school.
@AceDawg That makes a lot of sense. Thank you so much.
@gaius What you mean by instance of that class? I have heard people saying instance of a class but i never really understood it. By instance, do they mean the name of the class?