【发布时间】:2013-12-10 23:11:13
【问题描述】:
所以在我的代码中我有
double Matrix::get(int i, int j){
return data[i][j];
}
double Matrix::operator()(int i, int j){
return data[i][j];
}
问题是,课外我可以调用
Matrix A;
A(i,j)
类里面不知道怎么引用对象(A) 这样
Matrix::somefunction(){
this(i,j) ???
}
如何引用调用对象?
【问题讨论】:
-
(*this)(i, j)或this->operator()(i, j)。 -
operator()(i, j) 就足够了
标签: c++ object this operator-keyword