Over a million developers have joined DZone.

OperatorOverload.cpp

·
#include 

using namespace std;

class set
{
 public:
        set();
        set(int n, char *members);
        set operator + (set b);
        set operator * (set b);
        friend ostream& operator << (ostream& os, set a);
 private:
   int n;
   char *members;
};

set::set()
{
 this->n = 0;
}

set::set(int n, char *members)
{
 this->n = n;
 this->members = members;
}

set set::operator + (set b)
{
 int i,j,k;
 int cn;
 bool rep;
 int an = this->n;
 int bn = b.n;
 char *amembers = this->members;
 char *bmembers = b.members;

 cn = an+bn;
 for (j=0; jn;
 int bn = b.n;
 char *amembers = this->members;
 char *bmembers = b.members;

 cn = 0;
 for (j=0; j
                
            
Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}