40 lines
592 B
C++
40 lines
592 B
C++
#include <iostream>
|
|
|
|
class Date {
|
|
private:
|
|
int d, m, y;
|
|
|
|
public:
|
|
Date() throw();
|
|
|
|
Date(int, int, int);
|
|
|
|
~Date();
|
|
|
|
void out();
|
|
};
|
|
|
|
Date::Date() throw() {
|
|
this->d = 0;
|
|
this->m = 0;
|
|
this->y = 0;
|
|
std::cout << "Running constructor" << std::endl;
|
|
}
|
|
|
|
Date::Date(int date, int month, int year) {
|
|
this->d = date;
|
|
this->m = month;
|
|
this->y = year;
|
|
}
|
|
|
|
void Date::out() {
|
|
std::cout << this->d << "/" << this->m << "/" << this->y << std::endl;
|
|
}
|
|
|
|
int main() {
|
|
Date aDate;
|
|
Date bDate(3, 2, 4);
|
|
aDate.out();
|
|
bDate.out();
|
|
return 0;
|
|
} |