摘要:
为了支持c++的多态性,才用了动态绑定和静态绑定。 1、对象的静态类型:对象在声明时采用的类型。是在编译期确定的。 2、对象的动态类型:目前所指对象的声明。在运行期决定。对象的动态类型可以更改,但是静态类型无法更改。 关于对象的静态类型和动态类型,看一个示例: 3、静态绑定:绑定的是对象的静态类型, 阅读全文
posted @ 2018-08-08 22:06
ybf&yyj
阅读(1713)
评论(0)
推荐(0)
摘要:
#include<bits/stdc++.h> using namespace std; //定义一个函数指针 typedef int (*Fun)(int,int); int add(int a,int b){return a+b;} int sub(int a,int b){return a-b 阅读全文
posted @ 2018-08-08 16:23
ybf&yyj
阅读(349)
评论(0)
推荐(0)

浙公网安备 33010602011771号