c++封装

#include<bits/stdc++.h>
using namespace std;
class yuan
{
public:
//属性
int t;
//行为
int f()
{
return t*t;
}
};
int main()
{
yuan c1;
c1.t=3;
cout<<c1.f()<<endl;
return 0;
}

posted @ 2024-04-16 14:30  夜深人静写算法  阅读(15)  评论(0)    收藏  举报