📄 noinsitu.cpp
字号:
//: C09:Noinsitu.cpp
// From Thinking in C++, 2nd Edition
// at http://www.BruceEckel.com
// (c) Bruce Eckel 1999
// Copyright notice in Copyright.txt
// Removing in situ functions
class Rectangle {
int Width, Height;
public:
Rectangle(int W = 0, int H = 0);
int width() const; // Read
void width(int W); // Set
int height() const; // Read
void height(int H); // Set
};
inline Rectangle::Rectangle(int W, int H)
: Width(W), Height(H) {
}
inline int Rectangle::width() const {
return Width;
}
inline void Rectangle::width(int W) {
Width = W;
}
inline int Rectangle::height() const {
return Height;
}
inline void Rectangle::height(int H) {
Height = H;
}
int main() {
Rectangle R(19, 47);
// Transpose width & height:
R.height(R.width());
R.width(R.height());
} ///:~
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -