In the following lines of code, if I remove the '&' from the line ('***'), there would not be any change in the functionality apparently. Is there any reason to keep it as is or could it be useful in any case? Would you elaborate a little bit about the differences? Thanks.
#include <iostream>
class Entity
{
public:
void Print() const
{
std::cout << "Hello" << std::endl;
}
Entity()
{
std::cout << "Constructed!" << std::endl;
}
};
int main()
{
Entity e;
Entity* ptr = &e;
// ***
Entity& entity = *ptr;
entity.Print();
std::cin.get();
}