我遇到了一个错误,如以下this->p=b
所示。如果键入this->p=new int(b);
,则没有错误。请赐教。
class A{
int *p;
public:
A():p(new int){}
~A(){delete p;}
A(const A&) = delete;
A& operator=(const A&) = delete;
void GetValue(int b);
};
void A::GetValue(int b){
this->p=new int;
this->p=b; // error int can not be assigned to an entity of type int
}