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;
}
相关推荐
itmigrate7 小时前
前端项目里,Object.is 并不是 === 的平替
前端
小大宇8 小时前
Vue知识点6-computed计算属性
前端·javascript·vue.js
程序员海军8 小时前
尤雨溪 : Vue 4 已经在规划中了!
前端·javascript·vue.js
2601_949970698 小时前
HumanizeDuration 跨端三方库仓颉适配全流程
前端·javascript·flutter
风骏时光牛马10 小时前
后端服务接口开发与性能优化
前端
kyriewen10 小时前
我让 4 个 AI 互相 review 代码,最温柔的那个下手最狠
前端·程序员·ai编程
计算机魔术师11 小时前
493家公司白砸AI钱?Apollo这组数据戳破了幻觉
前端
IT_陈寒11 小时前
Java静态变量初始化坑得我头皮发麻
前端·人工智能·后端
柳杉11 小时前
用 Codex 完成智慧高速 3D 可视化大屏,从 18 张行业设计稿到可交互的运行监测中心
前端·ai编程·数据可视化
review4454311 小时前
拿到 codex 第一步
前端·agent·vibecoding