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;
}
相关推荐
一路向前的月光4 分钟前
uniapp(5)滚动列表scroll-view
前端·javascript·uni-app
Hilaku28 分钟前
就因为package.json里少了个^号,我们公司赔了客户十万块
前端·javascript·npm
晴殇i35 分钟前
尤雨溪创立的 VoidZero 完成 1250 万美元 A 轮融资,加速整合前端工具链生态
前端·vue.js
一大树43 分钟前
MutationObserver 完整用法指南
前端
一晌小贪欢1 小时前
【Html模板】赛博朋克风格数据分析大屏(已上线-可预览)
前端·数据分析·html·数据看板·看板·电商大屏·大屏看板
墨寒博客栈1 小时前
Linux基础常用命令
java·linux·运维·服务器·前端
野生龟1 小时前
designable和formily实现简单的低代码平台学习
前端
路多辛1 小时前
为什么我要做一个开发者工具箱?聊聊 Kairoa 的诞生
前端·后端
jerryinwuhan1 小时前
理论及算法_时间抽取论文
前端·算法·easyui
秋子aria1 小时前
模块的原理及使用
前端·javascript