title: Cannot convert argument 1 from 'const char [6]' to Object
body: <p>I'm trying to solve this assignment question since 3 days now and honestly, I ran out of solutions. 
  I created the declaration of the class Plant,attribute type and I overloaded the == &amp; != operators but I constantly getting the error message cannot convert argument 1 from const char [6] to Plant ? 
  I'm not sure what I'm missing ?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  using namespace std;
  
  
   class Plant {
   private: 
   char* type[10];  //Declare the type attribute of type Char [10]
  
    Plant(char* type1[10]); //Declare the const type1 of Object Plant 
  
    bool operator==(const Plant &amp;b) const
     {
         return ( (type ==b.type) );
     }
     bool operator!=(const Plant &amp;b) const
      {
      return ( (b.type!=type) );
      }
  
      //overload the print function
      void print()
      { cout &lt;&lt; type; 
       }
  
        };//end class Plant
  
        class Fruit: public Plant {
        public:
        char* taste [10];
  
         public:
         bool operator==(const Fruit&amp; rhs) const
         {
           //return (taste == rhs.taste &amp;&amp; type == rhs.type);
           return (taste == rhs.taste);
          }
  
          bool operator!=(const Fruit&amp; rhs) const
          { return (taste != rhs.taste );
           //return (taste != rhs.taste &amp;&amp; type != rhs.type);
          }
  
          void print()
          {printf("Hi Fruit");
           cout &lt;&lt; taste; 
           } // print to know if I reached this part
  
           };//end class Fruit
  
  
            int main() {
            Plant a((char*)"Maple");
            a.print();
            Plant b("Maple");
  
             if (a == b)
             printf("a and b are equal\n");
             else
             printf("a and b are not equal\n");
             if (a != b)
             printf("a and b are not equal\n");
             else
             printf("a and b are equal\n");
  
             Fruit c("Apple","sweet");
             c.print();
             Fruit d("Apple","sweet");
  
             if (c == d)
             printf("c and d are equal\n");
             else
             printf("c and d are not equal\n");
             if (c != d)
             printf("c and d are not equal\n");
             else
             printf("c and d are equal\n");
  
             if (a == c)
             printf("a and c are equal\n");
             else
             printf("a and c are not equal\n");
             if (a != c)
             printf("a and c are not equal\n");
             else
             printf("a and c are equal\n");
  
              if (c == a)
              std::cout &lt;&lt;"c and a are equal\n"&lt;&lt; std::endl;
              else
              std::cout &lt;&lt;"c and a are not equal\n"&lt;&lt; std::endl;
              if (a != c)
              std::cout &lt;&lt;"c and a are not equal\n"&lt;&lt; std::endl;
              else
              std::cout &lt;&lt;"c and a are equal\n"&lt;&lt; std::endl;
  
             return 0;
             }
  </code></pre>
  
  <p>I'm new to C++ just started learning and I've read the following 
  resources :</p>
  
  <ol>
  <li><a href="http://faculty.cs.niu.edu/~mcmahon/CS241/Notes/relational.html" rel="nofollow">http://faculty.cs.niu.edu/~mcmahon/CS241/Notes/relational.html</a> </li>
  <li><a href="http://www.cplusplus.com/doc/tutorial/basic_io/" rel="nofollow">http://www.cplusplus.com/doc/tutorial/basic_io/</a> 
  and many other websites but I'm not allowed to post more than 2.</li>
  </ol>
  
  <p>Any tip or help will be HIGHLY appreciated..</p>
  
  <p>Thank you!</p>