Have you declared Set operator-(const Set & ) ; inside class.
As Snoop Dog would said , fo'shizzle
Here's the header file :
#ifndef SET_H
#define SET_H
#include <iostream>
using std::ostream;
using std::istream;
class Set
{
friend ostream &operator<<( ostream &, const Set & );
friend istream &operator>>( istream &, Set & );
friend Set intersection(const Set & ,const Set & );
friend Set reunioun(const Set & , const Set & );
public:
Set( int = 10 ) ; // default constructor.
Set( const Set & ) ; // copy constructor
~Set() ; // destructor
int getSize() const ; // returns # of elements
const Set &operator=( const Set & ); // assignment operator overloading
bool operator==( const Set & ) const; // equality operator overloading
bool operator!=( const Set &right ) const // != operator
{ return ! ( *this == right ); }
int &operator[]( int ); // overloading [] subscript
const int &operator[]( int ) const ; // =====/ / / ==== for const objects
Set operator-(const & Set); // Here the compiler shows errors
static int getSetCount(); // returns the # objects instantiated
// some set operations
bool apartenenta(int ) ;
bool incluziunea (const Set & ) const ;
bool egalitatea() ;
private:
int size; // the size of vector
int *ptr; // pointer to the first element of the vector
static int count; // it retaines the # of objects instantiated Those links didn't help.
The funny thing is , that almost every person I asked about (most of them students in my class) , had encountered this problem with operator- overloading,but they didn't know the solution
It feels like a mysterious thing...
Last edited by Eko; Apr 13th, 2007 at 8:31 am.
Reputation Points: 12
Solved Threads: 1
Junior Poster in Training
Offline 60 posts
since Nov 2006