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;
}
相关推荐
syty20201 小时前
RedisTemplate方法汇总
前端·bootstrap·html
懒大王、1 小时前
Vue dcm文件预览
前端·javascript·vue.js·dcm·cornerstone.js
C_心欲无痕1 小时前
Docker 本地部署 SSR 前端项目实战指南
前端·docker·容器
梵得儿SHI1 小时前
Vue 高级特性:组件高级用法(动态组件、异步组件、组件缓存 keep-alive)
前端·javascript·vue.js·keep-alive·异步组件·动态组件·vue组件高级特性
EndingCoder1 小时前
泛型类和高级用法
linux·运维·前端·ubuntu·typescript
ℋᙚᵐⁱᒻᵉ鲸落1 小时前
【Vue3】Element Plus 表单显示自定义校验错误
前端·javascript·vue.js
程序员小寒1 小时前
聊一聊 CommonJS 和 ES6 Module
前端·ecmascript·es6
Java后端的Ai之路1 小时前
【AI应用开发工程师】-Gemini写前端的一个坑
前端·人工智能·gemini·ai应用开发工程师
亿元程序员1 小时前
最近很火的一个拼图游戏,老板让我用Cocos3.8做一个...
前端
m0_748250031 小时前
C++ Web 编程
开发语言·前端·c++