Let's suppose I have the following code:
class A
{
public:
A(int Val)
{
_val = Val;
}
virtual ~A() = default;
private:
int _val = 0;
};
class B
{
public:
B() = default;
virtual ~B() = default;
private:
A _a(3); // Error: expected identifier before numeric constant
};
int main()
{
B b;
return 0;
}
when I try to direct-initialize "A _a(3);" I will get the following error from the compiler: "xpected identifier before numeric constant" What is wrong about it?
Many thanks in advance