Skip to content

A small discriminative modification to the nature of override and overload #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2023
Merged

Conversation

lingkerio
Copy link
Contributor

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

  • Fixed a discriminative modification to override

Reference

Please add reference if necessary


说明

PR的目的是指明override和overload 的一点区别,以防止不清楚的人搞错。override的虚函数必须是基函数有函数签名与之一致的虚函数才可以,而overload只需要函数名一致(当然虚函数的重载还需要满足返回类型的协变)

变化箱单

  • 解决了关于 override 的辨析性修改

参考文献

如果有请注明

@changkun changkun merged commit ff6ee89 into changkun:master May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

关于普通重载和override的一个区别
2 participants