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;
}
相关推荐
薛定猫AI2 分钟前
【深度解析】从 Antigravity 更新看 Agent IDE 的工程化演进:权限、沙盒、MCP 与模型治理
前端·javascript·ide
漂流瓶jz6 小时前
总结CSS组件化演进之路:命名规范/CSS Modules/CSS in JS/原子化CSS
前端·javascript·css
踩着两条虫7 小时前
「AI + 低代码」的可视化设计器
开发语言·前端·低代码·设计模式·架构
Jagger_7 小时前
项目上线忙碌结束之后,为什么总想找点事做?
前端
GalenZhang8888 小时前
OpenClaw 配置多个飞书账号实战指南
前端·chrome·飞书·openclaw
萌新小码农‍9 小时前
python装饰器
开发语言·前端·python
threelab9 小时前
Three.js 初中数学函数可视化 | 三维可视化 / AI 提示词
开发语言·前端·javascript·人工智能·3d·着色器
爱学习的程序媛9 小时前
浏览器工作原理全景解析
前端·浏览器·web
我是若尘11 小时前
用 Git Worktree 同时开多个需求,不用来回 stash
前端
IT_陈寒11 小时前
Vue的v-for为什么不加key也能工作?我差点翻车
前端·人工智能·后端