Why isn't the const qualifier working on pointer members on const objects?

When a foo instance is const, its data members are const too, but this applies differently for pointers than you might at first think.

I am going to answer my own question in this case. Fred Nurk's answer is correct but does not really explain the "why". Mybar1 and *mybar1 are different.

The first refer to the actual pointer and the latter the object. The pointer is const (as mandated by the const-ness on foo; you can't do mybar1 = 0), but not the pointed to object, as that would require me to declare it const bar* mybar1. The declaration bar* mybar1 is equivalent to bar* const mybar1 when the foo object is const (i.e.

Pointer is const, not pointed to object).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions