I was used something like this in C# or other languages.
// C#, but I can't remember correctly. Just assume like a pseudo code.
class A
{
public int b;
public A(int newB)
{
b = newB
}
public static const A a1 = A(1);
public static const A a2 = A(2);
public static const A a3 = A(3);
}
Is there equivalent of this in C++? Or any recommended way to do this? I do this for just to organize a1, a2, a3 within its class name.
The following C++ code is equivalent to your C# code: