NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Warning (level 1) C4301

'function' of 'derivedclass': overriding virtual function only differs from 'baselcass::function' by const/volatile qualifier

The qualifiers in the parameter lists for the functions in the base and derived classes differ. The compiler implements the function declaration in the derived class. To resolve the warning, be sure the qualifiers match. The following sample generates C4301:

#include <stdio.h>

class Base
{
   public:
      virtual void Func(const int i) { 
         printf("base\n");
      }
};

class Derived : public Base
{
   public:
      void Func(int i) {      // C4301
         printf("derived\n");
      }

      /* use the code below to resolve the warning
      void Func(const int i) {
         printf("derived\n");
      }
      */
};

void main() {
   Base B;
   Derived D;

   B.Func(0);
   D.Func(0);
}