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;
}
相关推荐
vivo互联网技术29 分钟前
下一代图片格式 AVIF 在 vivo 社区的落地实践
前端·性能优化·图片压缩·avif
咸鱼翻身更入味32 分钟前
Vue创建一个简单的Agent聊天
前端
布局呆星38 分钟前
Vue Router 核心知识点梳理
前端·javascript·vue.js
得物技术41 分钟前
基于 Harness + SDD + 多仓管理模式的 AI 全栈开发实践|得物技术
前端·人工智能·后端
不会写DN1 小时前
如何通过 Python 实现招聘平台自动投递
开发语言·前端·python
miaowmiaow1 小时前
一行命令把 PSD 还原成 HTML / React / Vue:psd2code 实战干货
前端·ai编程
张元清1 小时前
React 中的语音与摄像头输入:语音识别、媒体设备与权限
前端·javascript·面试
用户841794814561 小时前
vxe-table 实现撤销与重做:单元格编辑后支持 Ctrl+Z 回退
前端
石小石Orz1 小时前
OpenAI官方:harness-engineering(工程技术:在智能体优先的世界中利用 Codex)
前端·后端