Array of classes within class definition
Does anyone know how to get this code to work? It compiles fine in Visual Studio, but not in Borland. I need this to work in Borland.
All I want to do is locally decare an array of classes within a class, and initalise them to their relevant values. However, in Borland I keep getting these errors:
[C++ Error] TJunction.h(21): E2034 Cannot convert 'A' to 'A[3]'
[C++ Error] TJunction.h(28): E2176 Too many types in declaration
Code:
class A
{
public:
A(int i) : m_i(i) {}
protected:
int m_i;
};
class B
{
public:
B() : m_A(A(1), A(2), A(3)) {}
protected:
A m_A[3];
}
Any help would be greatful