官术网_书友最值得收藏!

Compile-time polymorphism versus run-time polymorphism

Before we go further, let me pause for a minute and explain the previous two bullet points on polymorphism.

When we say compile-time polymorphism, we are saying that we will be declaring methods with the same name but with different signatures. Therefore, the same method can perform different functions based on the signature (parameters) it receives. This is also known as early binding, overloading, or static binding.

When we say run-time polymorphism, we are saying that we will be declaring methods with the same name and with the same signature. In a base class, for example, the method is overridden by the method in a derived class. This is achieved by what we call inheritance and by using the virtual or override keywords. Run-time polymorphism is also known as late binding, overriding, or dynamic binding.

主站蜘蛛池模板: 石河子市| 凤凰县| 大田县| 大竹县| 滁州市| 梁河县| 涞水县| 崇仁县| 武穴市| 黔江区| 丹棱县| 奉节县| 贡嘎县| 靖西县| 千阳县| 宣武区| 读书| 温州市| 河源市| 旬邑县| 庆云县| 怀安县| 西城区| 齐河县| 平阴县| 翼城县| 黎城县| 绿春县| 平南县| 平泉县| 陆丰市| 瓦房店市| 定兴县| 苏尼特左旗| 华宁县| 佛山市| 峨边| 金乡县| 东港市| 务川| 泗洪县|