Vladislav Boyko:
and are not pointers
and are not pointers
Although, we can deprive the pointer of its meaning too
class CFoo { CFoo*const ptr; };
Can such members be used in any way?
I suspect that such checks simply aren't worth the extra complexity to the compiler.
In addition, I saw that in C++ you can do something like this:
class CFoo { int i = 1; };
Therefore, perhaps this would be useful for compatibility when adding new language features.
But these are just my guesses.
I found a way to use it😄
Sorry for the flood.
class CFoo { public: const int m_a; const int m_b; CFoo(int a, int b): m_a(a), m_b(b) {}; }; void OnStart() { CFoo obj(1,2); }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm talking about const members of simple types that are not static (and are not pointers).
Why is it possible to make members of simple types const?
Such a member will not be initialized, that is, it will contain garbage. What is the point of protecting garbage?