Answer the question
In order to leave comments, you need to log in
Is it possible to initiate class components like this?
struct TList
{
byte n = 0;
int M[256];
void Reset() { n = 0; };
void Push(int x) { M[n] = x; n++; }
}
Answer the question
In order to leave comments, you need to log in
en.cppreference.com/w/cpp/language/class Section
"Member specification".
If you are using the c++11 standard and above, then the initialization of the fields is immutable.
The only exception would be a field initialization list in a custom constructor.
en.cppreference.com/w/cpp/language/initializer_list
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question