Time.h
#ifndef TIME_H
#define TIME_H
#define TIME_H
class Time
{
public:
Time();
Time(int,int,int);
virtual ~Time();
Time(const Time& other);
int Gethour() { return hour; }
void Sethour(int val) { hour = val; }
int Getminutes() { return minutes; }
void Setminutes(int val) { minutes = val; }
int Getseconds() { return seconds; }
void Setseconds(int val) { seconds = val; }
protected:
private:
int hour;
int minutes;
int seconds;
};
#endif // TIME_H
{
public:
Time();
Time(int,int,int);
virtual ~Time();
Time(const Time& other);
int Gethour() { return hour; }
void Sethour(int val) { hour = val; }
int Getminutes() { return minutes; }
void Setminutes(int val) { minutes = val; }
int Getseconds() { return seconds; }
void Setseconds(int val) { seconds = val; }
protected:
private:
int hour;
int minutes;
int seconds;
};
#endif // TIME_H
Time.cpp
#include "Time.h"
Time::Time(){
this.Sethour(0);
this.Setminutes(0);
this.Setseconds(0);
}
Time::Time(int hour,int minut,int sec)
{
this.Sethour(hour);
this.Setminutes(minut);
this.Setseconds(sec);
}
Time::~Time()
{
//dtor
}
Time::Time(const Time& other)
{
//copy ctor
}
main.cpp
#include <iostream>
#include "Time.h"
using namespace std;
int main()
{
Time myTime=new Time();
cout << "Hello world!" << endl;
return 0;
}
#include "Time.h"
using namespace std;
int main()
{
Time myTime=new Time();
cout << "Hello world!" << endl;
return 0;
}
0 Questions:
Post a Comment