Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

OperatorOverload.cpp

DZone's Guide to

OperatorOverload.cpp

·
Free Resource
#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; j
  
   n;
 int bn = b.n;
 char *amembers = this->members;
 char *bmembers = b.members;

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

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}