Create a class, Date, having the data members, dd, mm, yy. Create the following functions in Date class:
- Default Constructor
- Parameterised Constructor
- Copy Constructor
- getDate()
- showDate()
Solution
#include <iostream>
using namespace std;
class Date
{
int dd, mm, yy;
public:
Date()
{
dd = mm = yy = 0;
}
Date(int d, int m, int y)
{
dd = d;
mm = m;
yy = y;
}
Date(const Date &d)
{
dd = d.dd;
mm = d.mm;
yy = d.yy;
}
void getDate()
{
cout << "Enter the date in dd/mm/yy format: ";
cin >> dd >> mm >> yy;
}
void showDate()
{
cout << dd << "/" << mm << "/" << yy << endl;
}
};
int main()
{
Date d1;
d1.getDate();
Date d2(d1);
d2.showDate();
return 0;
}
Happy Learning – If you require any further information, feel free to contact me.


![[Solved] Version Management System with Java, C++, Python](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Version-Management-System-with-Java-C-Python-300x200.png)
![[Solved] Balls for Challenge with Java, C++, Python](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Balls-for-Challenge-with-Java-C-Python-300x200.png)