C++ 内联函数
来源:互联网 发布:solidworks软件画足球 编辑:程序博客网 时间:2024/06/01 19:33
使用内臵函数可以节省运行时间,但却增加了目标程序的长度。 因此一般只将规模很小声明为内臵函数。不能使用复杂控制语句,如switch 和while循环
具体实例:
#include <iostream>#include <string>using namespace std;class Student{private:string _name;int _num;public :Student(string str,int num):_name(str),_num(num){} inline void getValue();};inline void Student::getValue(){cout<<"name :"<<this->_name<<endl<<"num :"<<this->_num<<endl<<endl;}int main(){Student stu("buyingfei",100);stu.getValue(); return 0;}
运行结果:
- C语言内联函数
- C++:内联函数
- C 内联函数
- c++-inline 内联函数
- C语言内联函数
- C++_inline内联函数
- 【C++】内联函数,inline
- C++---函数内联
- C 内联函数
- [C++]内联函数
- c/c++内联函数
- C++_内联函数
- c++inline内联函数
- C++:内联函数
- 【C++】内联函数
- C中的内联函数行为
- linux c/c++ 内联函数
- C中的内联函数行为
- myeclipse导入eclipse
- 实现二叉树的先序遍历、中序遍历、后序遍历的递归非递归算法以及层次遍历算法
- 开源软件实践之linux高性能服务器编程框架和选型
- 关于NSPredicate(2)
- Java抓取网页数据(原网页+Javascript返回数据)
- C++ 内联函数
- MySQL:索引工作原理
- Android异步加载解决方案
- ocp 10g考试环境模拟器
- ProductModel.class.php
- 命令模式lua实现
- poj1273
- Hadoop2.2.0版本多节点集群安装及测试
- ARM架构kprobe应用及实现分析(9.0 arch_prepare_kprobe平台相关注册)