C++学习之内联函数
来源:互联网 发布:数控编程用的语言 编辑:程序博客网 时间:2024/06/05 16:47
内联函数的学习。
#include<iostream>#include<string>#include<fstream>using namespace std;#define f(x) (x+1)#define floor(x,b) ((x)>=(b)?0:1)// 加括号的好处#define band(x) ((x)>5&&(x)<10 ? (x):0)inline int plusOne(int x) {return ++x;} //c++中 内联函数代替 c中的宏 class Point{int i,j,k;public:Point():i(0),j(0),k(0){}Point(int ii,int jj,int kk) :i(ii),j(jj),k(kk) {}inline void print(const string & msg ="") const //内联函数{if(msg.size ()!=0 )cout<<msg<<endl;cout<<"i="<<i<<"," <<"j=" <<j<<","<<"k=" <<k<<endl;}};class Forward{int i;public:Forward():i(0) {}int kk() const { return g()+1;}//-------------向前引用int g() const { return i;}};class Access {int i;public:int read() const {return i;}// 内联函数 提高效率int set(int ii) {i=ii ;} };int main(){Point p,q(1,2,3);p.print ("value of p");q.print ("value of q");Forward frwd;frwd.kk ();return 0;}
- C++学习之内联函数
- C++学习之内联函数
- C/C++学习笔记10:内联函数
- C Primer Plus学习 五十四 内联函数
- 【C++】:C++之内联函数(inline)
- C++学习序列笔记之内联函数
- 《C++ Primer》学习之内联函数
- c++学习篇之内联函数
- C++学习之旅内联函数
- C++学习笔记十一之内联函数
- Kotlin学习之-6.3 内联函数
- 函数之内联函数
- C语言内联函数
- C++:内联函数
- C 内联函数
- c++-inline 内联函数
- C语言内联函数
- C++_inline内联函数
- js跳转页面方法
- Unable to find the ncurses libraries的解决办法 fedora 17
- MediaPlayer常见错误码
- 数据库按照指定字段加当前时间来创建表 存储过程
- 设置系统navigation的back按钮
- C++学习之内联函数
- 《数据通信与网络》笔记--数据链路层的流量控制
- Oracle笔记(二) SQLPlus命令
- Makefile 中:= ?= += =的区别
- 瓦片数据入库之MongoDB + Java 版本
- uname gethostname getdomainname
- 网络层复习题目
- 【error】new抛出std::bad_alloc
- 何为ibatis