B
BCC
In looking through some code I have inherited, I notice a lot of places
where the programmer used operator() as a function call:
void operator() (int x, int y);
Rather than an explicit function name:
void MyFunction(int x, int y);
Then when he instantiates a class he calls it:
MyClass myclass;
myclass (x, y);
vs.
MyClass myclass;
myclass.MyFunction(x, y);
Is there any advantage to this or is it just a style?
Thanks,
B
where the programmer used operator() as a function call:
void operator() (int x, int y);
Rather than an explicit function name:
void MyFunction(int x, int y);
Then when he instantiates a class he calls it:
MyClass myclass;
myclass (x, y);
vs.
MyClass myclass;
myclass.MyFunction(x, y);
Is there any advantage to this or is it just a style?
Thanks,
B