C Only show the class definition and the functions with NO C

C++

Only show the class definition and the functions with NO CODE in the functions.

Design a class called date. The class should store a date in three integers: month, day and year. There should be member functions to print the date. Show a constructor and the destructor. This should include what the functions would look like in the code file for the class, remember no code is needed for the function just the header of the function

Solution

According to your requirment I have created skelaton for the Data class as below. If you have any doubt please mention in comment.

Code:

#include <iostream>
using namespace std;


class date                                    //Class Date

{
   int month;
   int day;
   int year;

   public:

   date (int month , int day, int year)    //Constructor
   {

   date::month = month;
   date::day = day;
   date::year = year;

};
           

~date(){}                                   //Destructor
  
};

void date::showDate(){                        //Show Data function

   cout << month << \"/\" << day << \"/\" << year << endl;

}

int main()

{                                           //Main Method

   int month;

   int day;

   int year;

   date newDate(month, day, year);
   newDate.showDate();

   return 0;

}

C++ Only show the class definition and the functions with NO CODE in the functions. Design a class called date. The class should store a date in three integers:
C++ Only show the class definition and the functions with NO CODE in the functions. Design a class called date. The class should store a date in three integers:

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site