Timeline for Static const member initialization outside class
Current License: CC BY-SA 4.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 25, 2020 at 20:12 | comment | added | Eljay |
@Logicrat • the reason to make it static is the same as the reason to make any variable or function in a class static . Just because it is const doesn't change that.
|
|
Nov 25, 2020 at 19:25 | comment | added | Logicrat |
@DmitriChubarov Yes, a static member can change if it's not const , but given that it is const I don't see a reason to make it static.
|
|
Nov 25, 2020 at 15:07 | vote | accept | user12918858 | ||
Nov 25, 2020 at 14:56 | answer | added | Eljay | timeline score: 0 | |
Nov 25, 2020 at 14:08 | comment | added | t.niese |
how can i initialize static const int member outside class ? besides this option is there another? You already show how to initialize them outside of the class, why do you look for another option? What do you expect from another option that you can't do with the one you show in your question? What do you not like about the one you already know?
|
|
Nov 25, 2020 at 14:02 | answer | added | Quarra | timeline score: 2 | |
Nov 25, 2020 at 13:53 | comment | added | user12918858 | @t.niese besides this option is there another? | |
Nov 25, 2020 at 13:35 | comment | added | t.niese | You already do that in the part you commented out, so what's wrong with that approach? | |
Nov 25, 2020 at 13:25 | comment | added | user12918858 | @DmitriChubarov i want to know how can i initialize static const member , is there a way? | |
Nov 25, 2020 at 13:22 | comment | added | user12918858 | if you want to receive static array you must know your arrays size , static const int member is good way to do it. | |
Nov 25, 2020 at 13:21 | comment | added | Dima Chubarov |
What exactly is your question? Is there a way you want to initialize b that does not work?
|
|
Nov 25, 2020 at 13:17 | comment | added | Dima Chubarov |
@Logicrat the value of a static data member can be changed unless it is declared as const .
|
|
Nov 25, 2020 at 13:11 | comment | added | Logicrat |
What is the point of having static and const applied to the same variable?
|
|
Nov 25, 2020 at 13:11 | history | edited | Damien | CC BY-SA 4.0 |
added 71 characters in body
|
Nov 25, 2020 at 13:08 | history | asked | user12918858 | CC BY-SA 4.0 |