Hi,all
Please look program.
class AA
{
public:
void hello();
};
void AA::hello()
{
printf("this is class AA\n");
}
void display(const AA& s)
{
s.hello();
}
int main()
{
AA a;
display(a);
return 0;
}
I got some errors when compiling
Compiling...
main.cpp
D:\my_project\testcpp\main.cpp(17) : error C2662: 'hello' : cannot
convert 'this' pointer from 'const class AA' to 'class AA &'
Conversion loses qualifiers
Error executing cl.exe.
Who can tell me the reason. Appreciate for any advice.