A small discriminative modification to the nature of override and overload #265
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolve #264
Description
The purpose of the PR is to point out a little difference between override and overload to prevent people who don't know who get it wrong. The virtual function of override must be a virtual function with a function signature consistent with the basis function, and overload only needs the function name to be consistent (of course, the overload of the virtual function also needs to satisfy the covariance of the return type)
Change List
Reference
Please add reference if necessary
说明
PR的目的是指明override和overload 的一点区别,以防止不清楚的人搞错。override的虚函数必须是基函数有函数签名与之一致的虚函数才可以,而overload只需要函数名一致(当然虚函数的重载还需要满足返回类型的协变)
变化箱单
参考文献
如果有请注明