/
githubmirror
/
CPlusPlusThings
Обзор
Документация
Войти
/
githubmirror
/
CPlusPlusThings
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
practical_exercises/key_exercises/operator_circle.cpp
25 строк
481 B
zhangxing
support bazel complie this project and format code.
30 мар 2024, 17:00
30 мар 2024, 17:00
3c8a3f2
Код
Авторство
О чём код?
/* 重载圆括号的时钟.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(); }