// Code derived from Stroustrup's PPP2 book// § 9.4.4 Defining member functions// -and beginning on p 314// simple Date (some people prefer implementation details last)classDate{public:// constructor: check for valid date and initializeDate(inty,intm,intd);voidadd_day(intn);// increase the Date by n daysintmonth(){returnm;}// ...private:inty,m,d;// year, month, day};Date::Date(intyy,intmm,intdd)// constructor:y{yy},m{mm},d{dd}// note: member initializers{}voidDate::add_day(intn){// ...}//------------------------------------------------------------------------------intmonth()// oops: we forgot Date::{returnm;// not the member function, can’t access m}//------------------------------------------------------------------------------intmain(){{intx;// first define the variable x// ...x=2;// later assign to x}{[[maybe_unused]]intx{2};// define and immediately initialize with 2}Datesunday{2004,8,29};// initialize sunday with {2004, 8, 29}sunday.add_day(7);// skip 7 daysreturnsunday.month();// get sunday's month}