The const qualifier applied to a method has the effect of passing this it a const pointer; in particular, in your case it will be const UPNumber * .
However, this is not a problem for delete : in fact, you can use delete for the const pointer without having to do anything as indicated in Β§5.5.5 ΒΆ2:
[Note: a pointer to a const type may be an operand of a delete expression; there is no need to discard the constant (5.2.11) of the pointer expression before it is used as the operand of the delete expression. ]
Note that before the standard was completed, there was a lot of discussion about whether it was or was not a good idea, so some preliminary standard compilers throw an error when trying delete const pointers.
The idea behind this behavior is that otherwise you would not have a path to delete const objects without using const_cast ; see this question for more information.
source share