Author: James DennettJames Dennett
Date: Jan 17, 2007 21:19
Keith Thompson wrote:
> "Frankie" gmail.com> writes:
>> How can we change an already const defined data type without using the
>> keyword mutable?
>>
>> eg
>>
>> {
>> const int x = 6;
>> x = 7; // will give an error.
>> }
>>
>> So is there any other way to do it?
>
> If you want to be able to change it, don't declare it const.
>
> Something like this:
>
> *(int*)x = 7;
> ...
|