QT day 2

cpp 复制代码
#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::show()
{
    cout << width << " ";
    cout << height << endl;
}
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;
}

int main()
{
    rect rec;
    rec. init (3,4);
    rec.show();
    rec.set_w(7);
    rec.show();
    rec.set_h(10);
    rec.show();

    return 0;
}
相关推荐
海石19 小时前
微信小程序开发01:XR-FRAME的快速上手
前端·增强现实·trae
叶梅树1 天前
DocsJS npmjs 自动化发布复盘(Trusted Publisher)
前端·npm
我命由我123451 天前
Element Plus - Form 的 resetField 方法观察记录
开发语言·前端·javascript·vue.js·html·html5·js
清空mega1 天前
《Vue3 项目结构详解:components、views、assets、router、stores 到底该怎么理解?》
前端·javascript·vue.js
雨雨雨雨雨别下啦1 天前
Vue——小白也能学!Day6
前端·javascript·vue.js
XPoet1 天前
AI 编程工程化:Hook——AI 每次操作前后的自动检查站
前端·后端·ai编程
難釋懷1 天前
RedisTemplate配置读写分离
前端·bootstrap·html
冰暮流星1 天前
javascript如何实现删除数组里面的重复元素
开发语言·前端·javascript
网络点点滴1 天前
透传属性$attrs
前端·javascript·vue.js
90后的晨仔1 天前
OpenClaw macOS 完整安装指南
前端