ICSE Class 10 Computer Applications
Question 8 of 19
Constructors — Question 8
Back to all questions 8
Question Question 8
Define a constructor function for a Date class that initializes the Date objects with given initial values. In case initial values are not provided, it should initialize the object with default values.
public Date()
{
day = 1;
month = 1;
year = 1970;
}
public Date(int d, int m, int y)
{
day = d;
month = m;
year = y;
}