Z
z65536
Hello All!
I came across a class declaration for a Matrix class (in the book: C++
primer), in which are two overloaded methods for "operator ()"
The prototypes:
class Matrix{
public:
int &operator () (int, int);
int operator() (int, int) const;
...
}
The questions are:
1. Why do we need two? When they are invoked from the client, do they
look the same? (I think so)
2. How do they differ from each other in term of semantic?
Thanks to all!
hai
I came across a class declaration for a Matrix class (in the book: C++
primer), in which are two overloaded methods for "operator ()"
The prototypes:
class Matrix{
public:
int &operator () (int, int);
int operator() (int, int) const;
...
}
The questions are:
1. Why do we need two? When they are invoked from the client, do they
look the same? (I think so)
2. How do they differ from each other in term of semantic?
Thanks to all!
hai