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 }

 

posted @ 2013-11-02 15:08  Talbot3  阅读(151)  评论(0编辑  收藏  举报