X Tutup
Skip to content

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

Merged
changkun merged 2 commits intochangkun:masterfrom
lingkerio:master
May 7, 2023
Merged

A small discriminative modification to the nature of override and overload#265
changkun merged 2 commits intochangkun:masterfrom
lingkerio:master

Conversation

@lingkerio
Copy link
Copy Markdown
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

X Tutup