#include<iostream>
using namespace std;
class Date;
class Time{
    public:
        Time(int, int, int);
        void display(const Date&);
    private:
        int hour,minute,second;
};
class Date{
    public:
        Date(int, int, int);
        friend void Time::display(const Date&);
    private:
        int year,month,day;
};
Time::Time(int h,int m,int s):hour(h),minute(m),second(s){}
Date::Date(int y,int m,int d):year(y),month(m),day(d){}
void Time::display(const Date& date){
    cout<<date.year<<"-"<<date.month<<"-"<<date.day<<"  "
        <<hour<<":"<<minute<<":"<<second<<endl;
}
int main(){
    Time t1(11,29,25);
    Date d1(2020,3,12);
    t1.display(d1);
    void (Time::*p1)(const Date&);
    p1=&Time::display;
    (t1.*p1)(d1);
    return 0;
}
 
 
#include <iostream>
using namespace std;
class Point {
public:
    Point(int x = 0, int y = 0) : x(x), y(y) { }
    int getX() const { return x; }
    int getY() const { return y; }
private:
    int x, y;
};
int main() {
    Point a(4,5);
    Point *p1 = &a;
    int (Point::*funcPtr)() const = &Point::getX;
    
    cout << (a.*funcPtr)() << endl;    
    cout << (p1->*funcPtr)() << endl;
    return 0;
}