#include<iostream>
using namespace std;
struct node{
int a,b;
node()//赋初值
{
a=2;
b=3;
}
/* int fun(int x,int y){
return a+b+x+y;
}*/
/* int fun(int x)
{
cout<<"hhhh";
return x+b+a;
}*/
int operator ^ (const node &x)const{//重构 操作符
return x.a*b+x.b*a;
}
}d[100];
int main()
{
//node A={1,2},B={2,3},c;//第二种赋初值方法
node A,B,c;
printf("%d",d[1].b);
//cout<<d[0].a<<endl;
}
结构体的重构
最新推荐文章于 2023-07-13 16:51:28 发布