Im overloading the Double Parentheses function and using it inside the same class for a matrix in c++? Im confident I overloaded it properly but I do not know how to call it from inside itself.
Asked
Active
Viewed 1,007 times
1
-
1Your question is lacking some example code... – Christoph Sep 13 '13 at 00:00
1 Answers
2
I'm assuming that your Double Parentheses function is operator()
, then you can call it from inside other member functions in two different ways:
unsigned operator()(unsigned i) const
{
if(i == 0) return 1;
return operator()(i-1);
}
or
unsigned operator()(unsigned i) const
{
if(i == 0) return 1;
return (*this)(i-1);
}

SirGuy
- 10,660
- 2
- 36
- 66