I'm trying to convert structures to class, but I'm not completely sure of what exactly goes in a class header file. I've made some changes, can someone tell me what else I should change? Thank you!
structure:
enter code here:
#ifndef TIME_H
#define TIME_H
#include <iostream>
struct Time {
int hours, minutes, seconds;
};
void init(Time &t, int hours, int minutes, int seconds);
void normalize(Time &t);
Time operator +(const Time &t1, const Time &t2);
Time &operator +=(Time &t1, const Time &t2);
Time operator -(const Time &t1, const Time &t2);
Time &operator -=(Time &t1, const Time &t2);
bool operator ==(const Time &t1, const Time &t2);
std::ostream &operator <<(std::ostream &os, const Time &t);
std::istream &operator >>(std::istream &is, Time &t);
#endif
class:
#define TIME_H
#include <iostream>
class Time {
public:
void init(Time &t, int hours, int minutes, int seconds);
void normalize(Time &t);
Time operator +(const Time &t1, const Time &t2);
Time &operator +=(Time &t1,const Time &t2);
Time operator -(const Time &t1, const Time &t2);
Time &operator -=(Time &t1, const Time &t2);
bool operator ==(const Time &t1, const Time &t2);
std::ostream &operator <<(std::ostream &os, const Time &t);
std::istream &operator >>(std::istream &is, Time &t);
private:
int hours, minutes, seconds;
};
#endif