C + + compilation error cannot has cv-qualifier
in the C + + in CV means Const and the volatile two x keyword. There are two cases where you cannot use CV -qualification.
a non-member function cannot contain CV qualification, i.e. Const and the volatile Limited
#include <iostream>
using namespace Std;
Double Getarea () const
{
return 0.0;
}
Double Getvolume ()const
{
return 0.0;
}
int main (int arg,char *argv[])
{
cout<< getarea () << Endl;
cout<< getvolume () << Endl;
return 0;
}
compilation generates an error, meaning that a non-member function cannot have CV Qualifier, CV There are two qualifiers: Const and the volatile , here refers to Const .
second, static member functions cannot have CV qualification, i.e. Const and the volatile Limited.
header File static_cpp.h
#ifndef __static_h
#define __static_h
Class CStatic
{
Private:
static int static_value;
Public:
static int get_static_value () const;
};
#endif
source File staitc_cpp.cpp
#include "Static_cpp.h"
Intcstatic::get_static_value () const
{
return static_value;
}
in the main.cpp in
#include "Static_cpp.h"
#include <iostream>
using namespace Std;
int cstatic::static_value= 1;
int main (int argc,char*argv[])
{
cout<< cstatic::get_static_value ( ) <<endl;
return0;
}
compile error, meaning: Static member function, cannot have CV Qualifier, in C + + in CV qualifier refers to Const and the volatile , here refers to Const .
C + + compilation error cannot has Cv-qualifier