6-2-11

 1 #include<iostream>
 2 
 3 using namespace std;
 4 
 5 class Point
 6 {
 7 public:
 8     Point(int x=0,int y=0):x(x),y(y){}
 9     int getX() const {return x;}
10     int getY() const {return y;}
11 private:
12     int x,y;
13 };
14 int main()
15 {
16     Point a(4,5);
17     Point *p1;p1=&a;
18     cout<<(*p1).getX()<<endl;
19     cout<<a.getX()<<endl;
20     return 0;
21 }
原文地址:https://www.cnblogs.com/orangebook/p/3403774.html