When definitions and declarations are separated, the definition needs to match the declaration.
The const modifier affects function matching.
In other words, int a() const and int a() are two member functions.
When you define it outside the class, you can either add both or neither. Of course, you can also declare both. When calling, you will choose whether to call the const version based on the identity of the caller.
iniline does not affect function matching, it specifies whether the function is expanded inline.
When definitions and declarations are separated, the definition needs to match the declaration.
The const modifier affects function matching.
In other words,
int a() const
andint a()
are two member functions.When you define it outside the class, you can either add both or neither. Of course, you can also declare both. When calling, you will choose whether to call the const version based on the identity of the caller.
iniline does not affect function matching, it specifies whether the function is expanded inline.