Question: C + + / / Step 1 : Define a Public Class: Declare a Date class with public members: class Date { public: int day;
CStep : Define a Public Class:
Declare a Date class with public members:
class Date
public:
int day; Day of the Month
int month; Month of the year
int year; Year
;
Step : Create Objects:
Create Data Objects: In the main function, create two objects of type Date: today and tomorrow. Assign values to today using the following statements:
today.day
today.month
today.year
Use a cout statement to display the values of today.
pt Assign values to tomorrow in the same way.
Write the C code for this and insert the screenshot of the result here.
pt Change the access modifier of Date members from public to private and then compile the program. Briefly explain what happens when you try to access private members in main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
