C++的Early Binding和Late Binding

C++的Early Binding:Most of the function calls the compiler encounters will be direct function calls. A direct function call is a statement that directly calls a function. 

      Late Binding:In some programs, it is not possible to know which function will be called until runtime (when the program is run). This is known aslate binding (or dynamic binding). In C++, one way to get late binding is to use function pointers. To review function pointers briefly, a function pointer is a type of pointer that points to a function instead of a variable. The function that a function pointer points to can be called by using the function call operator (()) on the pointer.

 感觉早绑定就是在函数调用过程中编译器可以直接在内存中对调用的函数进行寻址,执行被调函数

       而晚绑定则是在程序运行时才能确定子函数的地址 通常子函数的调用由函数指针来决定。

      参考 http://www.learncpp.com/cpp-tutorial/124-early-binding-and-late-binding/

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值