I was wondering if someone could expl开发者_如何学Pythonain there terms since I encounter them in many places. I know some basic theory about them but not sure what I know is right or wrong.
So can any one please explain these terms?
A qualified name is one that has some sort of indication of where it belongs, e.g. a class specification, namespace specification, etc. An unqualified name is one that isn't qualified.
Read James McNellis' answer here:
What is a nested name specifier?
Given:
struct A {
struct B {
void F();
};
};
Ais an unqualified-id.::Ais a qualified-id but has no nested-name-specifier.A::Bis a qualified-id andA::is a nested-name-specifier.::A::Bis a qualified-id andA::is a nested-name-specifier.A::B::Fis a qualified-id and bothB::andA::B::are nested-name-specifiers.::A::B::Fis a qualified-id and bothB::andA::B::are nested-name-specifiers.
A qualified name is one that specifies a scope.
Consider the following sample program, the references to cout and endl are qualified names:
#include <iostream>
int main()
{
std::cout<<"Hello world!"<<std::endl;
return 0;
}
Notice that the use of cout and endl began with std::. These make them Qualified names.
If we brought cout and endl into scope by a using declaration or directive*(such as using namespace std;), and used just cout and endl just by themselves , they would have been unqualified names, because they would lack the std::.
加载中,请稍侯......
精彩评论