How does one initialize a const struct member of an object? Since it's const, this has to be done in the constructor initialization list. Unfortunately I can't seem to get the syntax right...
[code=cpp]
class Example
{
public:
Example() : st.a(1), st.b(5) // error
{
}
const struct TheStruct
{
int a;
int b;
} st;
};
[/code]
Obviously it looks like I'm trying to reference nonexistant methods of the struct. What is the correct syntax?
[code=cpp]
class Example
{
public:
Example() : st.a(1), st.b(5) // error
{
}
const struct TheStruct
{
int a;
int b;
} st;
};
[/code]
Obviously it looks like I'm trying to reference nonexistant methods of the struct. What is the correct syntax?
Comment