码迷,mamicode.com
首页 > 编程语言 > 详细

overload and overwrite in C++

时间:2016-07-20 21:12:29      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:

1. overload :

don‘t using it in different scope. it will hidden the one in base or global scope.

 

2. overwrite:

using it in different scope. add virtual in base scope. and only be effective for point and reference. will not work for object.

base.f();

derive.f();

 

base * bs=new derive();

bs->f() //base one without virtual;

bs->f() //derive one with virtual;

overload and overwrite in C++

标签:

原文地址:http://www.cnblogs.com/gaoxianzhi/p/5689581.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!