指针初始化
#include<iostream>using namespace std;
class point
{
private:
int x,y;
public:
void setpoint(int a,int b)
{
x=a;y=b;
}
int getx()
{
return x;
}
int gety()
{
return y;
}
};
int main()
{
point *op;
op->setpoint(1,2);
cout<<op->getx()<<endl;
return 0;
}
为啥不能运行呢?
另外“->”运算符号,与“.”运算符有什么区别?