在上题的基础上进行如下修改:在类体内声明成员函数,而在类外定义成员函数。 如需知道上题,请看上个博客 #include<iostream> using namespace std; class Time { public: int hour; int minute; int sec; }; int