新手问一个C/C++中的操作符"::"的含义和用法?
解决方案 »
- 无法定位序数798于动态链接库mfco42d
- 怎样使程序在托盘区建立图标而任务栏没有任务显示?
- 还原数据库文件不成功,在C:\MSSQL7\Data下能恢复数据库mdf和log文件,但最后还是报错,超时也设了5分钟肯定大于执行时间长度,最后还是失败。
- 请帮忙推荐好用的socket库
- 请问:xml文件中的 DOCTYPE节点怎么生成 用msxml库的
- 问一个问题在线等
- 有谁有关于列表控件(listctrl)自画的代码啊?
- 统一升级的问题,请大家讨论
- 组件和客户间传递IXMLDOMNodePtr的问题,请大家多帮忙。
- Microsoft的头文件编译出错?
- 感谢RockHwnd(0 error(s), 0 warning(s), Many bugs)帮我解决了问题,请进接分!
- 哪里下载DirectX SDK比较快啊?
如果前面没有东西,则表示全局的
建议楼主看看C++吧~~
这个就是域操作符~~
一般你定义一个类A,然后它有成员变量B或者成员函数F() ~~
那么访问它们直接用A::B~~A::F()~~~
就可以访问了~~~
:: identifier
class-name :: identifier
namespace :: identifier
Res
The identifier can be a variable or a function.If you have nested local scopes, the scope resolution operator does not provide access to identifiers in the next outermost scope. It provides access to only the global identifiers.Example
This example has two variables named amount. The first is global and contains the value 123. The second is local to the main function. The scope resolution operator tells the compiler to use the global amount instead of the local one. Copy Code
// expre_ScopeResolutionOperator.cpp
// compile with: /EHsc
// Demonstrate scope resolution operator
#include <iostream>using namespace std;int amount = 123; // A global variableint main() {
int amount = 456; // A local variable
cout << ::amount << endl // Print the global variable
<< amount << endl; // Print the local variable
}