当前位置:网站首页>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()其实也是一个函数,只不过这个函数定义在了一个命名空间里面了。
边栏推荐
- .net operation redis set unordered collection
- 回到顶部的几种方案(js)
- .net operation redis hash object
- .net operation redis string string
- 20210807#1 C语言程序结构
- Redis special data type usage scenarios
- Problems encountered in QRcode QR code (C language)
- RT-Thread 学习笔记(三)---用SCons 构建编译环境
- [leetcode daily question 2021/2/14]765. Lovers hold hands
- Flutter TextField设置高度并且自动换行,圆角边框去除下划线
猜你喜欢
![[dectectron2] follow the official demo](/img/aa/03e46897234c309415b336ac39b7d9.png)
[dectectron2] follow the official demo

RT thread learning notes (I) -- configure RT thread development environment

抽象工厂及其改进示例
![[leetcode daily question 2021/5/8]1723. The shortest time to complete all work](/img/e7/a48bb5b8a86cbc4cd5b37bb16661a8.png)
[leetcode daily question 2021/5/8]1723. The shortest time to complete all work
![[paper after dinner] deep mining external perfect data for chestx ray disease screening](/img/d6/41c75d292c26b2e7e116767a51eb5e.png)
[paper after dinner] deep mining external perfect data for chestx ray disease screening

Oracle cannot start tnslistener service cannot start

Analysis of the transaction problem of chained method call

在神州IV开发板上为STemWin 5.22加入触屏驱动

Dry goods likeshop takeout order system is open source, 100% open source, no encryption

Successfully transplanted stemwin v5.22 on Shenzhou IV development board
随机推荐
Oracle创建索引
PLC与伺服电机连接
Problems encountered in QRcode QR code (C language)
一文详解Nodejs中fs文件模块与path路径模块
剑指Offer(九):变态跳台阶
鹏哥C语言第四课(3)
Successfully transplanted stemwin v5.22 on Shenzhou IV development board
Uninstall Meizu app store
第5期:大学生入职必备技能之二
剑指Offer(十):矩形覆盖
鹏哥C语言20210811程序结构作业
Koin
10 let operator= return a reference to *this
多目标优化系列1---NSGA2的非支配排序函数的讲解
Issue 5: the second essential skill for College Students
Issue 6: which mainstream programming language should college students choose
如何实现临时的图形要素现实
剑指Offer(二十):包含min函数的栈
访问权限——private,public,protected
剑指Offer(七):斐波那契数列