-
-
Save chomado/4aeb4ff02ea9d9f8ba8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Time { | |
int h; | |
int m; | |
int s; | |
public: | |
Time(int hh, int mm, int ss); | |
int hour() { return h; } | |
int minute() { return m; } | |
int second() { return s; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "a.h" | |
Time::Time(int hh, int mm, int ss) | |
{ | |
h = hh; | |
m = mm; | |
s = ss; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "a.h" | |
int main() | |
{ | |
Time a(12, 35, 43); | |
Time b = a; | |
Time c = Time(17, 28, 39); | |
std::cout << "a = " << a.hour() << "時" << a.minute() << "分" << a.second() << "秒" << endl; | |
std::cout << "b = " << b.hour() << "時" << b.minute() << "分" << b.second() << "秒" << endl; | |
std::cout << "c = " << c.hour() << "時" << c.minute() << "分" << c.second() << "秒" << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment