hi,
I have several questions......
1) Please explain what are references and how it is different form pointers.
2)Considerr the following code.(extraced form "C++ in 21 days")
class Cat {
public :
/* code appears here */
...........
..........
const Cat & operator++();
private :
int itsValue;
}
const Cat& Cat:perator++(){
++itsValue;
return *this;
}
void main(){
Cat a;
Cat b=a++;
}
(i) In this code, the overloaded "++" operator returns the object itself. But the prototype of the function says it returns a reference to a Cat object.
(ii)And this return value (the reference to Cat object) is assigned to a Cat type variable. How is this possible ?
Please Explain.