I am not sure how to ask this question, but I need help in understanding the usage of :: when grabbing a member variable in a class? Rather than just typing that specific member variable instead?
For Example:
In Hpp file
#include using namespace std;class class_name{void add_name(name);string variable_name;};In CPP file:void add_name(string name){class_name::variable_name = name;}
using namespace std;
class class_name{
void add_name(name);
string variable_name;
};
In CPP file:
void add_name(string name){
class_name::variable_name = name;
}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here