title: "This declaration has no storage class or type specifier in C++"
body: <p>I have problem with my own class and operator =. When I try to attribute to one object of class Cow another one of the same class outside of some function I get an information "This declaration has no storage class or type specifier in C++". What's the problem? I'm sorry for my english.</p>
  
  <pre><code>    #include "Header.h"
  
  Cow cow5;
  Cow cow6;
  cow5 = cow6;
  
  int main()
  {
  
      Cow cow1;
      Cow cow2("cowa22", "hobby", 8);
      Cow cow3 = cow2;
      Cow cow4;
      cow2.operator=(cow3);
  }
  </code></pre>
  
  <hr>
  
  <pre><code>#include "Header.h"
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  
  Cow::Cow()
  {
      strcpy_s(name, sizeof(char)*20, "unnamed");
      hobby = nullptr;
      weight = 0;
  }
  
  Cow::Cow(const char * nm, const char * ho, double wt)
  {
      strcpy_s(name, sizeof(char) * 20, nm);
      hobby = new char[strlen(ho) + 1];
      strcpy_s(hobby, sizeof(char)*(strlen(ho)+1), ho);
      weight = wt;
  }
  
  Cow::Cow(const Cow &amp; c)
  {
      strcpy_s(name, sizeof(char) * 20, c.name);
      hobby = new char[strlen(c.hobby) + 1];
      strcpy_s(hobby, sizeof(char)*(strlen(c.hobby) + 1), c.hobby);
      weight = c.weight;
  }
  
  Cow::~Cow()
  {
      delete[] hobby;
  }
  
  Cow &amp; Cow::operator=(const Cow &amp; c)
  {
      if (&amp;c == this)
          return *this;
      delete[] hobby;
      strcpy_s(name, sizeof(char) * 20, c.name);
      hobby = new char[strlen(c.hobby) + 1];
      strcpy_s(hobby, sizeof(char)*(strlen(c.hobby) + 1), c.hobby);
      weight = c.weight;
  
      return *this;
  }
  
  void Cow::ShowCow() const
  {
      std::cout &lt;&lt; "Name: " &lt;&lt; name &lt;&lt; std::endl
          &lt;&lt; "Hobby: " &lt;&lt; hobby &lt;&lt; std::endl 
          &lt;&lt; "Weight: " &lt;&lt; weight &lt;&lt; std::endl;
  
  }
  </code></pre>