Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The following sample works in Visual C++ .NET 2003 as specified in the standard:
// support_aggregate_initialization1.cpp
struct NotAgg
{
NotAgg(int)
{
}
};
struct Agg
{
NotAgg mem;
};
int main()
{
Agg anAggregate = { NotAgg(1) };
}
The following sample works in Visual C++ .NET 2003 as specified in the standard:
// support_aggregate_initialization2.cpp
// compile with: /EHsc
#include <string>
#include <iostream>
using namespace std;
struct MyStruct
{
string strA;
string strB;
} myStrings[2] = { {"a", "b"}, {"c", "d"} };
int main()
{
cout << myStrings[0].strB << endl;
}