this->(i,j) doesnt work but this->_ij_val(i,j) does

B

bluekite2000

In class Matrix, I rather have just
virtual T& operator () (int i, int j)
{
}

since
virtual T& operator () (int i, int j)
{
}
and
virtual T& _ij_val(int i, int j)
{
}

do the same thing (accessing an element in my matrix) but I need both
since
init(int i, int j, int value)
{
this->(i,j)=value //compile error
this->_ij_value(i,j)=value //ok
}

Why doesnt it work??? Any solution???
 
F

Ferdi Smit

In class Matrix, I rather have just
virtual T& operator () (int i, int j)
{
}

since
virtual T& operator () (int i, int j)
{
}
and
virtual T& _ij_val(int i, int j)
{
}

do the same thing (accessing an element in my matrix) but I need both
since
init(int i, int j, int value)
{
this->(i,j)=value //compile error
this->_ij_value(i,j)=value //ok
}

Why doesnt it work??? Any solution???

The synatx you are using is not supported. (look a few posts down) Ie.
this->(i,j) is not the syntax to call the member operator(). You can fix it
by either typing (*this)(i,j), or this->operator()(i,j).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,297
Messages
2,571,536
Members
48,282
Latest member
Xyprime

Latest Threads

Top