首页 > 编程语言 > 详细

overload and overwrite in C++

时间:2016-07-20 21:11:36      阅读:229      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!