struct可以拥有class般的构造函数时间:2023-12-21 10:27:38 struct A { int a, b; A(int x, int y) :a(x), b(y){} }; int main() { A a(1, 2); cout << a.a << " " << a.b << endl; }