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 小时前
别再手写大屏了!用这套「3D 地图 + 拖拽脚手架」示例源码,交付效率提升 80%
前端·three.js·数据可视化
乌夷1 小时前
Vue.js 3 的设计思路
前端·javascript·vue.js
丨我是张先生丨2 小时前
英语单词 Web Page
前端·css·css3
随风一样自由2 小时前
【前端+Vitest测试框架】Vitest | Playwright | WebdriverIO | Preview
前端·前端框架·可用性测试
前端之虎陈随易11 小时前
编程语言级别的Skill市场,AI Agent 的未来形态
前端·vue.js·人工智能·typescript·node.js
一路向北he11 小时前
字节钢铁军团--“提供情境,而非控制”
java·开发语言·前端
kyriewen11 小时前
豆包和千问同时关了智能体,我用它们搭的 3 个自动化全废了——迁移方案整理
前端·javascript·ai编程
前端一小卒11 小时前
我用 TypeScript 从零手写了一个 Claude Code,然后发现它的核心只有 30 行
前端·agent
大圣编程13 小时前
Python中continue语句的用法是什么?
开发语言·前端·python
yuhaiqiang13 小时前
随手 vibecoding 的浏览器插件已经 6000 多次下载,聊聊他的产品设计
前端·后端·面试