How to initialise a struct-type in the initialisation list?

Posted by M4design on Stack Overflow See other posts from Stack Overflow or by M4design
Published on 2010-05-10T14:13:41Z Indexed on 2010/05/10 14:34 UTC
Read the original article Hit count: 241

How can I initilise a structure in the constructor list?

Say:

struct St{int x, y};

class Foo
{
public:
Foo(int a = 0, int b = 0) : /*here initilise st_foo out of a and b*/
{}

private:
const St st_foo;
};

© Stack Overflow or respective owner

Related posts about constructors

Related posts about initialization