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;
}
相关推荐
bcbobo21cn几秒前
Three.js绘制三角形网格平面
前端·javascript·平面·三角形面·基础材质
rleS IONS9 分钟前
分布式WEB应用中会话管理的变迁之路
前端·分布式
就叫飞六吧13 分钟前
在线考试翻页抓取题目导出js
开发语言·前端·javascript
坚持就完事了15 分钟前
Linux的重定向符
运维·服务器·前端
踩着两条虫25 分钟前
AI + 低代码实战 | 一文吃透 API 管理、Swagger 导入与全局配置
前端·低代码·ai编程
AI自动化工坊25 分钟前
T3 Code:专为AI编程代理设计的Web IDE技术实践指南
前端·ide·人工智能·ai编程·t3
梦梦代码精30 分钟前
LikeShop 深度测评:开源电商的务实之选
java·前端·数据库·后端·云原生·小程序·php
Mr.E531 分钟前
odoo18 关闭搜索框点击自动弹出下拉框
开发语言·前端·javascript·odoo·owl·odoo18
鹏程十八少33 分钟前
4. 2026金三银四 Android OkHttp 面试核心 45 问:从源码到架构深度解析
android·前端·面试
invicinble36 分钟前
前端技术栈--webpack
前端·webpack·node.js