语句哪里错了#includeusing namespace std;class B{public:void setpoint(int x);int showpoint();private:int *point;};void B::setpoint(int x){*point=x;};int B::showpoint(){return *point;};int main(){B a;a.setpoint(44);cout

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 20:48:16
语句哪里错了#includeusingnamespacestd;classB{public:voidsetpoint(intx);intshowpoint();private:int*point

语句哪里错了#includeusing namespace std;class B{public:void setpoint(int x);int showpoint();private:int *point;};void B::setpoint(int x){*point=x;};int B::showpoint(){return *point;};int main(){B a;a.setpoint(44);cout
语句哪里错了
#include
using namespace std;
class B{
public:
void setpoint(int x);
int showpoint();
private:
int *point;
};
void B::setpoint(int x){*point=x;};
int B::showpoint(){return *point;};
int main(){
B a;
a.setpoint(44);
cout

语句哪里错了#includeusing namespace std;class B{public:void setpoint(int x);int showpoint();private:int *point;};void B::setpoint(int x){*point=x;};int B::showpoint(){return *point;};int main(){B a;a.setpoint(44);cout
#include<iostream>
using namespace std;
class B{
public:
    void setpoint(int x);
    int showpoint();
private:
    int *point;
};
void B::setpoint(int x){point=new int(x);}//开辟内存空间
int B::showpoint(){return *point;};
int main(){
    B a;
    a.setpoint(44);
    cout<<a.showpoint();
    return 0;
}