自己封装一个矩形类(Rect),拥有私有属性:宽度(width)、高度(height),
定义公有成员函数:
初始化函数:void init(int w, int h)
更改宽度的函数:set_w(int w)
更改高度的函数:set_h(int h)
输出该矩形的周长和面积函数:void show()
#include <iostream>
using namespace std;
class Rect{
private:
    int width;
    int height;
public:
    void init(int width,int height);
    void set_w(int width);
    void set_h(int height);
    void show();
};
void Rect::init(int width,int height){
    this->width=width;
    this->height=height;
}
void Rect::set_w(int width){
    this->width=width;
}
void Rect::set_h(int height){
    this->height=height;
}
void Rect::show(){
    cout << "周长 = " << (width+height)*2 << "\t";
    cout << "面积 = " << width*height << endl;
}
int main()
{
    Rect r;
    r.init(10,10);
    r.show();
    r.set_w(20);
    r.set_h(50);
    r.show();
    return 0;
}







![解决Error in rawToChar(block[seq_len(ns)]) :](https://img-blog.csdnimg.cn/e3d61a20f58b4f07990207af4f6b683a.png)






![红队专题-从零开始VC++远程控制软件RAT-C/S-[2]界面编写及上线](https://img-blog.csdnimg.cn/dadfc297ab734c58959e6c6676e61948.png)






