什么是默认命名空间 [英] What is the default namespace

查看:51
本文介绍了什么是默认命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

c++中默认的命名空间是什么?

#includeB类{.....}int main(){.....}

那么 B 类在什么命名空间中?

解决方案

Bglobal namespace 中.它可以明确地称为 ::B.

Eric Z 在此处提供了 C++03 的摘录:https://stackoverflow.com/a/10269085>

what is the default namespace in c++?

#include<iostream>
class B{
 .....
}
int main(){
.....
}

so what namespace is class B in?

解决方案

B is in the global namespace. It can be referred to unambiguously as ::B.

Eric Z provides an excerpt from C++03 here: https://stackoverflow.com/a/10269085

这篇关于什么是默认命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆