I have class Foo with a constructor as given:
class Foo {
public:
Foo(int w, char x, int y, int z);
...
};
int main()
{
Foo abc (10, 'a');
}
Can I use that constructor like this? When constructor signature do not match?
So How do I give default value?
Not unless the parameters at the tail of the signature have defaults, for example:
If there are defaults, then you can supply only the non-defaulted parameters, and optionally some defaulted ones, i.e. any of the following invocations would be valid: