So for say I have a function called commonType. In my main.cpp file there is a call and it looks like this:
pokemon1.commonType(pokemon2)
Now I am confused as what to do. I am suppose to compare the types the pokemon has and if the have a common type, I would print out yes and if not, it would be no.
so I am stuck since the error says cannot convert:
'bool Pokemon::commonType(Pokemon &)' : cannot convert 'this' pointer from 'const Pokemon' to 'Pokemon &'
You correctly mark the parameters with const when the function is not supposed to modify the objects that's being passed as arguments.
What you also need to do is to mark the member functions themselves with const when you don't want the function to modify the object that the function is called on.