All I'm saying is that you can't use ba[j]. By default, the [] operator is only used for arrays. So, there are only two ways that ba[j] would be valid code. Either ba is an array of BitArray objects, or else you defined the [] operator for your BitArray class.
Now I have no idea how you're using the function, or what your class is supposed to do, but I'm going to guess that you don't want to pass an array to that function. In which case you shouldn't change
1 2 3 4 5
|
ostream& operator<< (ostream& out, const BitArray& ba)[/cod]e
to
[code]ostream& operator<< (ostream& out, const BitArray* ba)
|
What you should do is figure out what you meant by ba[j] and replace that with code that actually means something.
As for the other errors you got:
error C2228: left of '.Set' must have class/struct/union |
That would be because ba[j] doesn't mean anything, it's totally undefined. It's not a BitArray object, so it doesn't have a Set function.
type qualifier is not compatable with this memeber function |
That would be because you changed the function definition without changing the function protocol in your class definition. Which you can forget about since, as I said, you probably weren't trying to pass an array.