Need help.

This is a discussion on Need help. within the C++ Programming forums, part of the General Programming Boards category; In a program, it has
class simplecat
{
public:
simplecat();
simplecat(simplecat&);
~simplecat();
....
....
etc...
What does this offer, why ...

because simplecat(simplecat) would be an infinite loop. The function we are talking about there is called the copy constructor. It is called whenever a copy of an object needs to be made. If we pass a simplecat to it by value then we would have to copy it hence calling the copy constructor. To get around this and also for reasons of efficiency we pass the object by reference or better still by const reference. The ampersand denotes that this is a reference. simplecat& is reference to simplecat.