当前位置:网站首页>C语言命名空间的定义与使用
C语言命名空间的定义与使用
2022-07-26 10:43:00 【aLLLiyyy】
众所周知std是一个命名空间,它里面可以定义一系常量,变量跟函数,最简单的命名空间的定义如下:
namespace Output {
int i = 10;
const int con = 15;
void printStr() {
printf("hello");
}
}
using namespace Output;
上面定义了一个Output的命名空间,里面分别有一个常量,变量,函数。如果我们想要使用它们,可以这样
Output::printStr()
就可以直接调用这个函数了。同理,std::bind()其实也是一个函数,只不过这个函数定义在了一个命名空间里面了。
边栏推荐
- RT thread learning notes (III) -- building a compilation environment with scons
- [machine learning notes] [style transfer] deeplearning ai course4 4th week programming(tensorflow2)
- 【机器学习小记】【搭建循环神经网络及其应用】deeplearning.ai course5 1st week programming(keras)
- Flutter jni混淆 引入.so文件release包闪退
- C language calculation date interval days
- [leetcode daily question 2021/2/14]765. Lovers hold hands
- 第5期:大学生入职必备技能之二
- .net operation redis string string
- [leetcode daily question 2021/2/13]448. Find all the missing numbers in the array
- Build ARM embedded development environment
猜你喜欢
![[leetcode daily question 2021/2/13]448. Find all the missing numbers in the array](/img/9b/624416fa6a408bf64ca5438273176b.png)
[leetcode daily question 2021/2/13]448. Find all the missing numbers in the array
![[leetcode daily question 2021/4/29]403. Frogs cross the river](/img/fb/612777c77df5a611506e72f4f4c3c8.png)
[leetcode daily question 2021/4/29]403. Frogs cross the river

344.反转字符串

第8期:云原生—— 大学生职场小白该如何学

RT-Thread 学习笔记(三)---用SCons 构建编译环境

第5期:大学生入职必备技能之二

Disable usbjatg in Altium Designer

【小程序】onReachBottom 事件为什么不能触发 ?(一秒搞定)

抽象工厂及其改进示例

RT thread learning notes (I) -- configure RT thread development environment
随机推荐
鹏哥C语言20210811程序结构作业
Issue 5: the second essential skill for College Students
鹏哥C语言第七节课总结
Zongzi battle - guess who can win
剑指Offer(十):矩形覆盖
json_ object_ put: Assertion `jso->_ ref_ count > 0‘ failed. Aborted (core dumped)
[leetcode daily question 2021/2/18] [detailed explanation] minimum number of turns of 995. K continuous bits
Sql Server 之SQL语句对基本表及其中的数据的创建和修改
C language calculation date interval days
使用float实现左中右布局,中间内容自适应
剑指Offer(二十):包含min函数的栈
使用Geoprocessor 工具
Oracle create index
.net operation redis sorted set ordered set
Oracle创建索引
使用grid实现左中右布局,中间内容自适应
The problem of formatting IAR sprintf floating point to 0.0 in UCOS assembly
SQL Server 之Sql语句创建数据库
IAR sprintf 浮点 在UCOS 总格式化成0.0的问题
2021-08-12函数递归_和鹏哥学习C语言