you are not doing "不同派生类转换成基类指针来操".
if say apple is fruit, you want to be able to test :
"a fruit" == "a fruit",
"an apple" == "an apple",
this is perfectly fine, but what you didn't realize is that you also asked:
"an apple" =="a something is fruit"
or
"a something is fruit" == "a something is fruit"
so C++ will ask you to tell it how to do it, you want to compare two apples? or two oranges or one apple and one orange? and HOW?
or: What exactly is your question?
- this apple is/is not that apple?
or
- an orange is/is not an apple?
if say apple is fruit, you want to be able to test :
"a fruit" == "a fruit",
"an apple" == "an apple",
this is perfectly fine, but what you didn't realize is that you also asked:
"an apple" =="a something is fruit"
or
"a something is fruit" == "a something is fruit"
so C++ will ask you to tell it how to do it, you want to compare two apples? or two oranges or one apple and one orange? and HOW?
or: What exactly is your question?
- this apple is/is not that apple?
or
- an orange is/is not an apple?