The class dateType in my program was designed to implement the date in a program.
However, the function and constructor don’t check whether the date is valid before storing. … rewrite the definition of the function setDate and constructor so that the values for month, day, year are checked before storing…
I understand the validation would be a display of the entered date so the user can verify it is correct.
We are also asked to add a function member isLeapYear, to check if the year is a leap year.
I will use the function for leap year test
(year % 400 = = 0 || (year % 100! = =0 && year % 4 = =0)).
This is what I understand of simple class
dateType(int newMonth, int newDay, int newYear);
// get methods
int getYear() const;
int getMonth() const;
int getDay() const;
1. Does this declare a data type or variable?
2. What is public/private (I understand access control, but not understanding the benefits of using private)?
3. I understand const = = constant, but don’t understand the results of using ?
4. Is there a difference between a class declaration and definition?
Thanks for your help