Abtract parameter types?

Hello guys,

I don't know whether this is the right name for what I'm going to ask about. But I see often functions called or implemented in Qt and other programs in a way:

1
2
3
4
my_function(int)
{
    ...
}


this abstract "int" in the parameter list without variables names I can't understand. How is it used? and what is it? to what extend can it be used? I see it often in slots/signals connect function in Qt!

Any useful simple examples to understand this?

Thank you :)

In connect it is used to tell the type of value a signal will emit and that will be caught by the slot. If the parameter is different than the slot will fail to catch. so for example, this is correct:

1
2
connect(buttonsOrientationComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(buttonsOrientationChanged(int)));


but this will fail as the slot will not know the signal type:
1
2
connect(buttonsOrientationComboBox, SIGNAL(currentIndexChanged()),
            this, SLOT(buttonsOrientationChanged(int)));
Thank you for the fast answer!

So this form doesn't have any other use in C++? I mean in standard C++?

I have not seen it anywhere but wait for more replies. :)
I just means that the parameter passed in to the function is unused. Some compilers warn about unused parameters, so its common to leave it unnamed to avoid the warning.
Thanks guys :D
Topic archived. No new replies allowed.