Skip to content

Instantly share code, notes, and snippets.

@dibakarsutradhar
Created September 2, 2018 07:07
Show Gist options
  • Save dibakarsutradhar/40c4f7964755e21cd3b21e854b5a92e4 to your computer and use it in GitHub Desktop.
Save dibakarsutradhar/40c4f7964755e21cd3b21e854b5a92e4 to your computer and use it in GitHub Desktop.
#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