Audison Athena wrote on 24/09/2005 19:01:05:
[...]
>
> class RandomGenObj {
[...]
> int main() {
> vector v1(10, 10);
> RandomGenObj rg();
You have just declared a function named rg, that
accepts void and returns RandomGenObj by value.
C++'s ambiguity is a great thing, isn't it?
>
#include
#include
#include
#include
#include
#include
using namespace std;
class RandomGenObj {
public:
RandomGenObj() {
srand(static_cast(time(0)));
}
int operator()(int remainder) const {
return rand() % remainder;
}
};
int main() {
vector v1(10, 10);