Classes and Structs

I'm doing a project for my Advanced C++ class and I am to use a class to get the user to input a roman numeral and the output will be the positive integer. Sounds easy enough, I'm not just following what a class is. Can someone break it down Barney style for me? This is what I understand:
Classes are expanded structs that contain either private (non-manipulated variables or functions) or public (can be manipulated).
The syntax for the class should be written above the main.
Question: if a variable that is declared in the class, which is above the main, does that make the variable global?
Question: I am not entirely sure how to use the const syntax after a function within the class. I think it means that it is a user defined function and stays that value until the program runs again. Right or Wrong?

Please help. I cannot really write any of this program until I understand this better. I have read the tutorial about classes, but I'm still a bit confused.
In C++, the struct keyword has the same meaning as the class keyword, except for the default member visibility. Class members are private by default while struct members are public by default.
dub1987 wrote:
Question: if a variable that is declared in the class, which is above the main, does that make the variable global?
Just like in a struct, no - the variable is local to the class.
dub1987 wrote:
Question: I am not entirely sure how to use the const syntax after a function within the class. I think it means that it is a user defined function and stays that value until the program runs again. Right or Wrong?
Wrong - marking a member function as const means that it will not change the state of the class in any way. The this pointer for a const member function is Type const * vs a non-const member function being Type *. You will want to research const-correctness as it is an incredibly powerful concept in C++.
Ok thanks.
Topic archived. No new replies allowed.