Created
September 2, 2018 07:07
-
-
Save dibakarsutradhar/40c4f7964755e21cd3b21e854b5a92e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class DateClass { | |
public: | |
int m_year; | |
int m_month; | |
int m_day; | |
void print(){ | |
cout << m_year << "/" << m_month << "/" << m_day; | |
} | |
}; | |
int main(){ | |
DateClass today { 2018, 9, 1 }; | |
today.m_day = 2; // use member selection oparetor to select a member variable of the class | |
today.print(); // use memeber selection oparetor to call a member function of the class | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment