C ++覆盖...覆盖? [英] C++ Overriding... overwriting?

查看:134
本文介绍了C ++覆盖...覆盖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道C ++中的覆盖是什么。但是,是否有覆盖

解决方案

在C ++术语中,您有重写(与类层次结构中的虚拟方法有关)和重载(与具有相同名称但采用不同参数的函数相关)。您还可以隐藏名称(通过在嵌套声明区域或作用域中显式声明相同的名称)。



C ++标准不除非使用其规范的英语形式(即,用一个新值替换一个值,如在重写前一个值的赋值 x = 10 中使用术语覆盖 x )。


I know what overriding is in C++. But, is there overwriting? If so, what does it mean?

Thanks.

解决方案

In C++ terminology, you have overriding (relating to virtual methods in a class hierarchy) and overloading (related to a function having the same name but taking different parameters). You also have hiding of names (via explicit declaration of the same name in a nested declarative region or scope).

The C++ standard does not use the term "overwrite" except in its canonical English form (that is, to replace one value with a new value, as in the assignment x = 10 which overwrites the previous value of x).

这篇关于C ++覆盖...覆盖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆