# include <iostream>
using namespace std;
struct St
{
int a;
float b;
};
class CStu
{
public:
St st;
CStu(St st0):st(st0)
{
cout<<st0.a<<" "<<st0.b<<endl;
}
void show()
{
cout<<st.a<<" "<<st.b<<endl;
}
};
int main()
{
St st0 = {5,12.5f};
CStu stu(st0);
stu.show();
cout<<" "<<sizeof(3.5f)<<endl;
cout<<"hello world"<<endl;
system("pause");
return 0;
}
类中包含结构体的参数初始化
猜你喜欢
转载自blog.csdn.net/ChaoFeiLi/article/details/103527373
今日推荐
周排行