33 lines
999 B
C++
33 lines
999 B
C++
#ifndef EXAMPLE12_DATE_H
|
|
#define EXAMPLE12_DATE_H
|
|
|
|
#include <string>
|
|
|
|
class Date {
|
|
private:
|
|
int day;
|
|
int month;
|
|
int year;
|
|
public:
|
|
Date();
|
|
// Date(const Date& date);
|
|
Date(int d, int m, int l);
|
|
virtual ~Date();
|
|
|
|
int getDay() const;
|
|
void setDay(int day);
|
|
int getMonth() const;
|
|
void setMonth(int month);
|
|
int getYear() const;
|
|
void setYear(int year);
|
|
|
|
// A std::string is a class which defines objects that be represented as stream of characters.
|
|
// Size of the character array has to allocated statically, more memory cannot be allocated
|
|
// at run time if required. Unused allocated memory is wasted in case of character array.
|
|
// In case of strings, memory is allocated dynamically. More memory can be allocated at run time
|
|
// on demand. As no memory is preallocated, no memory is wasted.
|
|
const std::string toString() const;
|
|
bool isEqual(const Date& date) const;
|
|
};
|
|
#endif //EXAMPLE12_DATE_H
|