如何看待这里的warning
#include "stdafx.h"
class Person
{
public:
operator=(int nYY)
{
nYear=nYY;
}
OnYear()
{
printf("It is %d years old!\n",nYear);
};
private:
int nYear;
};
/*
Person::OnYear()
{
printf("It is %d years old!\n",nYear);
}*/
int main(int argc, char* argv[])
{
Person son;
son=27;
son.OnYear();
return 0;
}
//////////////////////////////////////////////
Compiling...
T6.cpp
D:\00_Win32 Code\T6\T6.cpp(17) : warning C4183: 'OnYear': member function definition looks like a
ctor, but name does not match enclosing class
Linking...
T6.exe - 0 error(s), 1 warning(s)