Changing a const object?

I've come this code and it works so I must be reading it wrong.

Critter& Critter::operator=(const Critter& c)

does this mean the parameter is constant reference to an object or
a reference to constant object. The code works so it seems like it would have to be constant reference to an object. But wouldn't that be overkill? References can't change what they refer to, right?

1
2
3
4
5
6
7
8
9
10
11
  Critter& Critter::operator=(const Critter& c) //overloaded assignment op def
{
	cout << "Overloaded Assignment Operator called\n";
	if (this != &c)
	{
		delete m_pName;
		m_pName = new string(*(c.m_pName));
		m_Age = c.m_Age;
	}
        return *this;
}
Last edited on
never mind I got it now c isn't being changed, this is being changed.
Last edited on
Topic archived. No new replies allowed.