I am making a class called Time in C++ and the class has 3 integers as private member variables. I am pretty new at using classes in C++ and am trying to figure out how to solve this particular problem. The problem is that when I try to do this:
#include <iostream>
#include <cctype>
#include <cstdlib>
using namespace std;
class Time
{
private:
int hours;
int minutes;
int seconds;
void normalize();
public:
Time() {hours = minutes = seconds = 0; normalize();};
Time(int a, int b, int c);
friend Time operator + (const Time& t1, const Time& t2);
friend Time operator - (const Time& t1, const Time& t2);
friend bool operator < (const Time& t1, const Time& t2);
friend istream& operator >>(istream& ins, Time& t1);
friend ostream& operator <<(ostream& out, Time& t1);
};
Time::Time(int a, int b, int c)
{
hours = a;
minutes = b;
seconds = c;
normalize();
}
void Time::normalize()
{
int s = seconds;
int m = minutes;
int h = hours;