Skip to content

Instantly share code, notes, and snippets.

@chomado
Created August 4, 2014 02:45
Show Gist options
  • Save chomado/4aeb4ff02ea9d9f8ba8f to your computer and use it in GitHub Desktop.
Save chomado/4aeb4ff02ea9d9f8ba8f to your computer and use it in GitHub Desktop.
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; }
}
#include "a.h"
Time::Time(int hh, int mm, int ss)
{
h = hh;
m = mm;
s = ss;
}
#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