C
ccs
1. How to make the code work?
class CTest
{
public:
int n;
CTest(int v) : n(v) { }
};
class CContainer
{
int nn;
private:
vector<CTest> Array( nn, CTest(8) );
public:
CContainer(int v) : nn(v) {}
};
int main(void)
{
CContainer cc(50);
...
}
2. Compared to the above design of CContainer class, what benefits does the
following one have?
class CContainer
{
int nn;
private:
vector<CTest*> ptrToArray;
public:
CContainer(int v) : nn(v) {}
};
Thanks in advance!
class CTest
{
public:
int n;
CTest(int v) : n(v) { }
};
class CContainer
{
int nn;
private:
vector<CTest> Array( nn, CTest(8) );
public:
CContainer(int v) : nn(v) {}
};
int main(void)
{
CContainer cc(50);
...
}
2. Compared to the above design of CContainer class, what benefits does the
following one have?
class CContainer
{
int nn;
private:
vector<CTest*> ptrToArray;
public:
CContainer(int v) : nn(v) {}
};
Thanks in advance!