T
Teddy
Hello all
consider the class Date declaretion below:
class Date {
public:
Date();
Date(int year, int month, int day);
Date(const string&);
int getYear() const;
int getMonth() const;
int getDay() const;
friend bool operator<(const Date&, const Date&);
friend bool operator>(const Date&, const Date&);
friend bool operator<=(const Date&, const Date&);
friend bool operator>=(const Date&, const Date&);
friend bool operator==(const Date&, const Date&);
friend bool operator!=(const Date&, const Date&);
private:
int years;
int months;
int days;
};
Can I remove the keyword friend in the six overload operator
declaretions?
If I did so, would they still act the same?
consider the class Date declaretion below:
class Date {
public:
Date();
Date(int year, int month, int day);
Date(const string&);
int getYear() const;
int getMonth() const;
int getDay() const;
friend bool operator<(const Date&, const Date&);
friend bool operator>(const Date&, const Date&);
friend bool operator<=(const Date&, const Date&);
friend bool operator>=(const Date&, const Date&);
friend bool operator==(const Date&, const Date&);
friend bool operator!=(const Date&, const Date&);
private:
int years;
int months;
int days;
};
Can I remove the keyword friend in the six overload operator
declaretions?
If I did so, would they still act the same?