类继承中调用函数

#include "stdafx.h"
class B{
public:
    void fun(){ fun2(); }
    void fun2(){ cout << "B" << endl; }
};

class C:public B{
public:
    void fun2(){ cout << "C" << endl; }
};

int main(){
    C c;
    c.fun();
}
// output:
// B

posted on 2011-12-07 01:08 メmarsメ 阅读(210) 评论(0)  编辑 收藏 引用 所属分类: 点滴积累

<2012年1月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

导航

统计

常用链接

留言簿

随笔分类

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜

评论排行榜