D
Dave Theese
Hello all,
In the code below, why does a syntax error appear at the location commented
"Syntax error!!!"? What language rule is coming into play here?
The example below also shows an alternative (use of an initializer list) to
the illegal syntax I attempted to use, but I'm still left wondering why I
could not do what I attempted...
Thanks,
Dave
#include <iostream>
#include <vector>
using namespace std;
class foo
{
public:
foo(): a(10) {for (int i = 0; i != a.size(); ++i) cout << a <<
endl;}
private:
vector<int> a;
vector<int> b(10); // Syntax error!!!
};
int main()
{
foo y;
return 0;
}
In the code below, why does a syntax error appear at the location commented
"Syntax error!!!"? What language rule is coming into play here?
The example below also shows an alternative (use of an initializer list) to
the illegal syntax I attempted to use, but I'm still left wondering why I
could not do what I attempted...
Thanks,
Dave
#include <iostream>
#include <vector>
using namespace std;
class foo
{
public:
foo(): a(10) {for (int i = 0; i != a.size(); ++i) cout << a <<
endl;}
private:
vector<int> a;
vector<int> b(10); // Syntax error!!!
};
int main()
{
foo y;
return 0;
}