#include<iostream>usingnamespace std;classshape{char x;public:shape(char m){
x = m;
cout <<"构造"<< x << endl;}~shape(){
cout <<"析构"<< x << endl;}};intmain(){
shape* b =newshape('b');delete b;return0;}
构造b
析构b
//此处空一行
#include<iostream>//重载,vs2019,clion的array貌似关键名,这里全部arrat改成大写ARRAY#include<iomanip>//11 22usingnamespace std;constint N =2;classARRAY{private:double a[N];public:ARRAY(){};ARRAY(double x[N]){for(int i =0; i < N; i++)
a[i]= x[i];}
ARRAY operator+(ARRAY& m){
ARRAY temp;for(int i =0; i < N; i++)
temp.a[i]= a[i]+ m.a[i];return temp;}voidprint(){for(int i =0; i < N; i++)
cout <<setw(4)<< a[i]<< endl;
cout << endl;}};intmain(){double arr1[N]={1,2};double arr2[N]={10,20};
ARRAY A(arr1);
ARRAY B(arr2);
ARRAY C;
C = A + B;
cout <<"结果= "<< endl;
C.print();return0;}