📄 inline.cpp
字号:
//: C09:Inline.cpp
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 2000
// Copyright notice in Copyright.txt
// Inlines inside classes
#include <iostream>
#include <string>
using namespace std;
class Point {
private:
int i, j, k;
public:
Point(): i(0), j(0), k(0)//default construct function
{}
Point(int ii, int jj, int kk): i(ii), j(jj), k(kk) //three parameters construct
{}
void print(const string& msg = "") const//with default argument const memeber function
{
if(msg.size() != 0)
cout << msg << endl;
cout << "i = " << i << ", " << "j = " << j << ", " << "k = " << k << endl;
}
};
void main()
{
Point p, q(1,2,3);
p.print("value of p");
q.print("value of q");
} ///:~
//Here, the three constructors and the print( ) function are all inlines by default.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -