Calling Contructor With Params outside function scope

This thing wont let me compile :


class Foo{

public:
Foo();
~Foo();
private:
Bar b(0, 0); // this is a constructor for the class Bar.
};

However if Bar doesn't have a constructor that takes parameters, this works fine.
I know we can use pointers, but any other way? "I really like the dot operator"
* What compiler are you using?
* What's the definition of Bar?
* What's the error message?

However if Bar doesn't have a constructor that takes parameters, this works fine.
Are you saying that the compiler only accepts the line Bar b(0, 0); in that context if Bar's constructor takes no parameters?
Topic archived. No new replies allowed.