title: deprecated covariant return type for virtual
body: <p>hi everyone i get some warnings while compiling my code with codeblocks which don't know what does it mean, should ignore them or that would reflect on my program during its execution</p>
  
  <pre><code>\src\..\inc\UTDB_Field.h|56|warning: deprecated covariant return type for 'virtual int* UTDB_intField::get_valField() const'
  \src\..\inc\UTDB_Field.h|19|warning: overriding 'virtual void* UTDB_Field::get_valField() const'
  </code></pre>
  
  <p>In fact <code>virtual void* UTDB_Field::get_valField() const</code> const is a pure virtual function in UTDB_Field(the base class) and <code>virtual int* UTDB_intField::get_valField() const</code> const is the derived's one(UTDB_intField).</p>
  
  <p>i found several explanations of what does co variant return type means but what i understood  is that the return type void* (in my case) is lost and was replaced by int*, for me that is is my goal i want a generic type of return and each derived class will take in charge of its own.</p>
  
  <p>here is my operator== defined in the derived class UTDB_intField:</p>
  
  <pre><code> virtual bool operator==(const UTDB_Field&amp; Field) const
  {
       if(this-&gt;typeF==(Field.get_typeField()))
        {
             if(this-&gt;nameF==(Field.get_nameField()))
             {
                  if (this-&gt;val== Field.get_valField())
                  return true;
                  else
                  {
                      std::cout&lt;&lt;" val 1: "&lt;&lt;*(this-&gt;get_valField())&lt;&lt;" and val2:  "&lt;&lt;*(int*)Field.get_valField() &lt;&lt;" are different"&lt;&lt;std::endl;
                      return false;
                  }
              }
              else
                  {
                      std::cout&lt;&lt;" name 1: "&lt;&lt;this-&gt;get_nameField()&lt;&lt;" and name 2: "&lt;&lt;Field.get_nameField() &lt;&lt;" are different"&lt;&lt;std::endl;
                      return false;
                  }
        }
        else  {
                  std::cout&lt;&lt;" type "&lt;&lt;this-&gt;typeF&lt;&lt;" and "&lt;&lt;Field.get_typeField() &lt;&lt;" are two incomparable types"&lt;&lt;std::endl;
                  return false;
              }
  };
  </code></pre>
  
  <p>when i test it with this :</p>
  
  <pre><code>string  a="CurrField";
  string* val=&amp;a;
  int b=5;
  int* val2=&amp;b;
  
  std::cout&lt;&lt;"  *Construction*"&lt;&lt;endl;
  
  UTDB_Field* UTField=new UTDB_strField("name",val);
  
  UTDB_Field* UTField2=new UTDB_intField("Currency",val2);
  
  std::cout&lt;&lt;" --------------- "&lt;&lt;std::endl;
  std::cout&lt;&lt;"result of comparison "&lt;&lt;(*UTField2==(*UTField))&lt;&lt;endl;
  </code></pre>
  
  <p>i get my message: type int and str are two incomparable types</p>
  
  <p>result of comparison 0</p>
  
  <p>So if the tow Fields have the same type it is OK i know what type i have, but if they doesn't i should have the message of incompatibility.</p>
  
  <p>any help will be appreciated </p>
  
  <p>thanks in advance</p>