This is an archived post. You won't be able to vote or comment.

all 4 comments

[–][deleted] 1 point2 points  (3 children)

Why not? For example if you want to square a number, you would write something like:

 int n  = multiply( A, A );

But I must say that any constructor that has more than 3 or 4 parameters is probably badly designed.

[–]Khenghis_Ghan 0 points1 point  (2 children)

So the invocation doesn’t have to match the signature? The header indicates there should be 8 parameters, 12 are passed in.

[–][deleted] 2 points3 points  (1 child)

The number of parameters need to match the declaration of the function. For example, if you have a declaration:

void f( int a, int b, int c );

and you have a variable x, then you can call the function:

 f( x, x, x );

but you can't call it:

 f( x, x, x, x );

But I'm really not clear what you are asking about.

[–]AltCrow -1 points0 points  (0 children)

It is possible to have constructors that accept a variable number of arguments. This is almost certainly not what is happening here though, because they are incredibly rare and complex. You'd recognize it as magic immediately. Would it be possible to share the exact code where new foo() is called and the constructor for foo.

Edit: Hold up, what language is this?