0% found this document useful (0 votes)
13 views2 pages

Date Class Documentation

A

Uploaded by

djnynrd26t
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Date Class Documentation

A

Uploaded by

djnynrd26t
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Class Date Documentation

Class Overview
The Date class represents a date with day, month, and year attributes. It provides various
member functions for date manipulation and input/output operations.

Public Members

Date(int day = 1, int month = 1, int year = 2024)


Constructs a Date object with the specified day, month, and year. If no arguments are
provided, it defaults to January 1, 2024.

Date(const Date&)
Creates a new Date object as a copy of an existing Date object.

Friend Functions

istream& operator >>(istream&, Date&)


Overloads the input stream operator to read a Date object from an input stream.

ostream& operator <<(ostream&, const Date&)


Overloads the output stream operator to write a Date object to an output stream.

Date operator +(int days)


Adds a specified number of days to the Date object and returns a new Date object.

Date operator -(int days)


Subtracts a specified number of days from the Date object and returns a new Date object.

Date& operator ++()


Increments the Date object by one day and returns a reference to the updated Date object.

Date operator ++(int)


Increments the Date object by one day and returns a copy of the original Date object.

Date& operator --()


Decrements the Date object by one day and returns a reference to the updated Date object.

Date operator --(int)


Decrements the Date object by one day and returns a copy of the original Date object.

bool checkNamNhuan(const int&)


Checks if a given year is a leap year.
bool isValid(const Date& date)
Validates the Date object to ensure the day, month, and year are correct.

const Date& operator =(const Date&)


Assigns the value of one Date object to another and returns a reference to the current
object.

You might also like