当前位置:首页 > C+ + 程序设计(04737) > 正文内容

#include<iostream>
using namespace std;
class base
{
private:
int m;
public:
base(){};
base(int a):m(a){}
int get(){return m;}
void set(int a){m=a;}
};
void main()
{
base*ptr=new base[2

高老师1年前 (2024-10-02)C+ + 程序设计(04737)8

#include<iostream>
using namespace std;
class base
{
private:
int m;
public:
base(){};
base(int a):m(a){}
int get(){return m;}
void set(int a){m=a;}
};
void main()
{
base*ptr=new base[2];
ptr->set(30);
ptr=______________;
ptr->set(50);
base a[2]={1,9};
cout<<a[0].get()<<","<<a[1].get()<<endl;
cout<<ptr->get()<<",";
ptr=ptr-1;
cout<<______________<<endl;
delete[]ptr;
}

第1空:PTR+1;
第2空:PTR->GET( )

扫描二维码免费使用微信小程序搜题/刷题/查看解析。

版权声明:本文由翰林刷题小程序授权发布,如需转载请注明出处。

本文链接:https://doc.20230611.cn/post/239789.html

分享给朋友: