Write your question here.
Using eclipse, if the object is a constant, it allows to return a constant object too. The compiler complains "invalid initialization of reference of type 'Vector&' from expression of type 'const Vector'.
But, according to book C++ Primer plus Stephen Prata page 662, it should work.
Why is that? is there any setting i need to ignore this error?
Well, the problem there is that you are returning a non-const reference (which allows modification) to a const object (which doesn't), which you simply can't do because it violates const correctness.
If the book you are reading says you can, it is incorrect.