Code
class A
{
public:
void f(const int i);
};
void A::f(int i)
{
std::cout<<++i<<std::endl;
}
int main()
{
A a;
a.f(1);
}
Why compiler does not give an error in this case ? Why the definition overrides the constant argument ? Also, when the argument is of type reference (&)
Is there any compiler flag to enable warning on these mentioned cases ?
Aucun commentaire:
Enregistrer un commentaire