> For the complete documentation index, see [llms.txt](https://sisyphus.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sisyphus.gitbook.io/project/c++-notes/scope-resolution-operator.md).

# Scope Resolution Operator ::

可以用于在类外定义类的成员函数

当前面没有scope 时 （::parameter）代表全局

（1）表示“域操作符”例：声明了一个类A，类A里声明了一个成员函数void f()，但没有在类的声明里给出f的定义，那么在类外定义f时， 就要写成void A::f()，表示这个f()函数是类A的成员函数。

（2）直接用在全局函数前，表示是全局函数例：在VC里，你可以在调用API 函数里，在API函数名前加 ::

（3）表示引用成员函数及变量，作用域成员运算符例：System::Math::Sqrt() 相当于System.Math.Sqrt()；

<http://blog.csdn.net/qq_33266987/article/details/53689133>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sisyphus.gitbook.io/project/c++-notes/scope-resolution-operator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
