1 Star 2 Fork 0

岑剑伟 / CPlusPlusThings

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
operator_circle.cpp 481 Bytes
一键复制 编辑 原始数据 按行查看 历史
/* 重载圆括号的时钟.cpp */
#include <iostream>
using namespace std;
class Time {
private:
int hh, mm, ss;
public:
Time(int h = 0, int m = 0, int s = 0) : hh(h), mm(m), ss(s) {}
void operator()(int h, int m, int s) {
hh = h;
mm = m;
ss = s;
}
void ShowTime() { cout << hh << ":" << mm << ":" << ss << endl; }
};
int main() {
Time t1(12, 10, 11);
t1.ShowTime();
t1.operator()(23, 20, 34);
t1.ShowTime();
t1(10, 10, 10);
t1.ShowTime();
}
C++
1
https://gitee.com/genvex/CPlusPlusThings.git
git@gitee.com:genvex/CPlusPlusThings.git
genvex
CPlusPlusThings
CPlusPlusThings
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891