title: Intersection and union of two strings
body: <p>I have to eliminates any occurrence of string 2 in string 1 and also find the intersection of two strings.</p>
  
  <p>Here is what I have tried:</p>
  
  <pre><code>#include "stdafx.h"
  #include "stdio.h"
  #include "conio.h"
  #include "string.h"
  
  class operation
  {
  public:
      char string1[100];
      char string2[50];
  
  
      operation(){};
      operation(char a[100], char b[50]);
      operation operator+(operation);
      operation operator-(operation);
      operation operator*(operation);
  };
  
  operation::operation(char a[100], char b[50])
  {
      strcpy(string1, a);
      strcpy(string2, b);
  }
  
  operation operation::operator +(operation param)
  {
      operation temp;
      strcpy(param.string1, temp.string1);
      strcpy(param.string2, temp.string2);
      strcat(temp.string1, temp.string2);
      return (temp);
  }
  
  operation operation::operator -(operation param)
  {
      operation temp;
      strcpy(param.string1, temp.string1);
      strcpy(param.string2, temp.string2) ;
      for (int i = 0; i&lt;strlen(temp.string2); i++)
      {
          temp.string1.erase(i, 1);
      }
      return (temp);
  }
  
  operation operation::operator *(operation param)
  {
      operation temp;
      strcpy(param.string1, temp.string1);
      strcpy(param.string2, temp.string2);
      char result[50];
      for(int i = 0; i&lt;strlen(temp.string2); i++)
      {
          if( temp.string1.find( temp.string2[i] ) != string::npos )
              result = result + temp.string2[i];
      }
  
      return (temp);
  
  }
  </code></pre>
  
  <p>I am getting compiler errors and also I am not sure what I am trying is correct or not.</p>
  
  <p>The errors are as follows:</p>
  
  <pre><code>C2228: left of .erase must have class/struct/union
  C2228: left of .find must have class/struct/union
  </code></pre>