C++对象指针笔记
声明形式
类名 *对象指针名
例:Point a(5,10);
Point *ptr;
ptr = &a;
通过指针访问对象成员
对象指针名->成员名
ptr->getx() 相当于(*ptr).getx();
例如:
#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(