// Code derived from Stroustrup's PPP2 book// § 9.4.3 Keep details private// -and beginning on p 313#include<iostream>usingstd::cout;// simple Date (control access)classDate{public:Date(inty,intm,intd);// check for valid date and initializevoidadd_day(intn);// increase the Date by n daysintmonth(){returnm;}intday(){returnd;}intyear(){returny;}private:inty,m,d;// year, month, day};Date::Date(inty,intm,intd):y{y},m{m},d{d}{}intmain(){Datebirthday{1970,12,30};// OK// birthday.m = 14; // error: Date::m is privatecout<<birthday.month()<<'\n';// we provided a way to read m}