Skip to content

Commit ff6ee89

Browse files
authored
book: discriminative modification to the nature of override and overload (changkun#265)
1 parent e86e4a4 commit ff6ee89

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

book/en-us/02-usability.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ C++11 introduces the two keywords `override` and `final` to prevent this from ha
971971
972972
### override
973973
974-
When overriding a virtual function, introducing the `override` keyword will explicitly tell the compiler to overload, and the compiler will check if the base function has such a virtual function, otherwise it will not compile:
974+
When overriding a virtual function, introducing the `override` keyword will explicitly tell the compiler to overload, and the compiler will check if the base function has such a virtual function with consistent function signature, otherwise it will not compile:
975975
976976
```cpp
977977
struct Base {

book/zh-cn/02-usability.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ C++11 引入了 `override` 和 `final` 这两个关键字来防止上述情形
880880
881881
#### override
882882
883-
当重载虚函数时,引入 `override` 关键字将显式的告知编译器进行重载,编译器将检查基函数是否存在这样的虚函数,否则将无法通过编译:
883+
当重载虚函数时,引入 `override` 关键字将显式的告知编译器进行重载,编译器将检查基函数是否存在这样的其函数签名一致的虚函数,否则将无法通过编译:
884884
885885
```cpp
886886
struct Base {

0 commit comments

Comments
 (0)