各位板友好
目前在學習 method overloading,已經了解到不同 method 要 overloading 的前提是:
1. method的名稱要相同
2. 參數的型別順序或種類不同
另外,看到一句話有點不解
Internally, the compiler uses longer method names that include
the original method name,
the types of each parameter and the exact order of the parameters
to determine whether the methods in a class are unique in that class.
解讀這句話的意思是:
編譯器實際的作法,是用較長的 method 簽名,來判定
類別中的其餘 method 是否為唯一。
但還是想多了解一些細節
我可以理解,不管程式中有無呼叫這些 overloaded method,編譯器也應該會去
比較不同 method,來確定類別中一定不會發生兩個以上的 method 有著相同簽名
但所謂的「longer」的意思是,有著較多參數的 method 嗎?
如果有板友能再多解釋一下編譯器的實際判定作法就太好了
謝謝~