Hi folks,

I am trying to write a C++ class where i can add or subtract 2 seperate boolean arrays. If you look at my code, where I overload the first + operator, I get an error here because while performing the OR operation, I am trying to map a BOOL value into the class SETS value. So the compiler is asking for a SETS(BOOL) method. I'm pretty lost here and would sincerely appreciate any advise.

#include <iostream.h>

class sets

{

private:

bool *set;

int element;

public:

sets();

sets(bool []);

sets operator + (sets v)const;

sets operator * (sets v)const;

sets operator + (int f)const;

friend istream& operator >> (istream& istr,sets& v);

friend ostream& operator << (ostream& ostr,sets& v);

};

sets :: sets()

{

*set=0;

}

sets :: sets(bool x[])

{

set=x;

element=(sizeof(x)/sizeof(bool));

}

sets sets :: operator + (sets v)const

{

for (int i=0,j=0;i<element,j<v.element;i++,j++)

return sets(*(set+i) || *(v.set+j));

}

sets sets :: operator * (sets v)const

{

for (int i=0,j=0;i<element,j<v.element;i++,j++)

return sets(*(set+i) && *(v.set+j));

}

sets sets :: operator + (int f)const

{

if (f<=element && f > 0)

*(set+(f-1))=1;

for (int i=0;i<element;i++)

return sets(*(set+i));

}

ostream& operator << (ostream& ostr,sets& v)

{

for (int i=0;i<v.element;i++)

{ostr << "{" << *(v.set+i) << "}";}

return ostr;

}

int main()

{

sets s3[5];

int e1=4;

s3 = s3 + 5;

cout << s3;

}