I have some values such as width, height among some other that I set in the constructor at this moment. They are not currently constants but I want them to be that so I will change them now.
But I heard that it is not common to make such variables private const without also doing private static const. Is this the case? Or is it valid in this case? I also need centerWidth, which will be set by dividing the width variable by 2. Can I do this if I make them constants?
Are these values specific to the instance of the object, but only set in the constructor? Then
staticdoes not make sense, as every object would have the same height and width.If you make a private data member
const, the default assignment operator won’t work and you will need to provide one.