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;
}
相关推荐
冒冒菜菜1 分钟前
RSAR的前端可视化界面
前端
asdfg125896313 分钟前
数组去重(JS)
java·前端·javascript
鹏多多14 分钟前
前端大数字精度解决:big.js的教程和原理解析
前端·javascript·vue.js
恋猫de小郭26 分钟前
八年开源,GSY 用五种技术开发了同一个 Github 客户端,这次轮到 AI + Compose
android·前端·flutter
少年姜太公6 小时前
什么?还不知道git cherry pick?
前端·javascript·git
白兰地空瓶8 小时前
🏒 前端 AI 应用实战:用 Vue3 + Coze,把宠物一键变成冰球运动员!
前端·vue.js·coze
Liu.7749 小时前
vue3使用vue3-print-nb打印
前端·javascript·vue.js
松涛和鸣10 小时前
Linux Makefile : From Basic Syntax to Multi-File Project Compilation
linux·运维·服务器·前端·windows·哈希算法
dly_blog10 小时前
Vue 逻辑复用的多种方案对比!
前端·javascript·vue.js
万少10 小时前
HarmonyOS6 接入分享,原来也是三分钟的事情
前端·harmonyos