Compiler error

Hi all,

Can anyone help me to understand why i get the compilation error C2109: subscript requires array or pointer type.
Thanks in advance.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef INTEGERSET_H
#define INTEGERSET_H
#include <vector>
using namespace std;

class IntegerSet
{
public:
	static vector< bool > emptySet( static const int );
	static const int sizeOfSet = 100;
	
	IntegerSet(vector < bool > &); 
	void outputVector();
	vector< bool > unionOfSets( vector< bool > & , vector < bool > & );
private:
	
};

#endif

#include <iostream>
#include "IntegerSet.h"
#include <vector>
using namespace std;

void IntegerSet::outputVector() 
{
	for ( int i = 0; i < sizeOfSet; i++ )
	cout << emptySet[ i ];
}

IntegerSet::IntegerSet( vector < bool > &emptySet )
{

	for ( int i = 0; i < sizeOfSet; i++ )
		emptySet[ i ] = false ;	
	outputVector();
}

#include <iostream>
#include "IntegerSet.h"
#include <vector>
using namespace std;


int main()
{
          IntegerSet a();
	
}

Last edited on
1
2
3
4
5
6
7
static vector< bool > emptySet( static const int ); //this is a function declaration

int main()
{
          IntegerSet a(); //this one too
	
}
So, how you declare a static vector of type boolean of size given by static const integer in the header file.
Topic archived. No new replies allowed.