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;
}
相关推荐
gogoing13 小时前
Babel 配置与工具
前端·javascript
亲亲小宝宝鸭13 小时前
重新install,项目就跑不起来了?!
前端·npm
Mike117.13 小时前
GBase 8a 物化视图依赖和 DDL 风险排查记录
java·服务器·前端
蜡台14 小时前
Vue3 Hook 与 Store 状态管理:深度解析与选型指南
前端·javascript·vue.js
無名路人14 小时前
小程序点餐页吸顶滚动
前端·微信小程序·ai编程
小小小前端啊14 小时前
前端手写代码大全
前端
李白的天不白14 小时前
大规模请求数据并发问题
java·前端·数据库
冲浪中台15 小时前
【无标题】
前端·低代码
openKaka_15 小时前
beginWork 的第一站:HostRoot 如何把 App 接入 Fiber 树
前端·javascript·react.js
我命由我1234515 小时前
Dart - Dart SDK、Hello World 案例、变量声明、常量声明、常量 final、字符串类型
前端·flutter·前端框架·html·web·dart·web app