class declaration in header file c 2b 2b example

Solutions on MaxInterview for class declaration in header file c 2b 2b example by the best coders in the world

showing results for - "class declaration in header file c 2b 2b example"
Riccardo
16 Apr 2017
1class Date
2{
3private:
4    int m_year;
5    int m_month;
6    int m_day;
7
8public:
9    Date(int year, int month, int day)
10    {
11        setDate(year, month, day);
12    }
13
14    void setDate(int year, int month, int day)
15    {
16        m_year = year;
17        m_month = month;
18        m_day = day;
19    }
20
21    int getYear() { return m_year; }
22    int getMonth() { return m_month; }
23    int getDay()  { return m_day; }
24};
25