The Wayback Machine - https://web.archive.org/web/20130629053440/http://zh.cppreference.com:80/w/cpp/language/final

final specifier

来自cppreference.com

 
 
C + +語言
大會的主題
Original:
General topics
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
流量控制
Original:
Flow control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
條件執行語句
Original:
Conditional execution statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
迭代語句
Original:
Iteration statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
跳轉語句
Original:
Jump statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
功能
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
函數聲明
lambda函數的聲明
函數模板
的歷史。內嵌說明
異常規範 (過時了)
noexcept說明 (C++11)
例外
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
命名空間
Original:
Namespaces
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
類型
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
decltype specifier (C++11)
規範
Original:
Specifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
CV符
存儲時間說明符
constexpr說明 (C++11)
汽車符 (C++11)
alignas說明 (C++11)
初始化
Original:
Initialization
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
布爾文字
nullptr (C++11)
用戶定義的 (C++11)
表達式
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
另一種表示形式
實用工具
Original:
Utilities
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
類型
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
typedef declaration
聲明類型別名 (C++11)
屬性 (C++11)
施放
Original:
Casts
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
隱式轉換
const_cast conversion
static_cast conversion
dynamic_cast conversion
reinterpret_cast conversion
C-風格和功能轉換
內存分配
Original:
Memory allocation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
類特定的功能特性
Original:
Class-specific function properties
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
虛函數
覆蓋說明 (C++11)
最後說明 (C++11)
明確的 (C++11)
靜態的
特殊的成員函數
Original:
Special member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
模板
Original:
Templates
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
類模板
函數模板
模板特化
參數包 (C++11)
雜項
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
內聯彙編
 
指定一個虛函數不能在派生類中被覆蓋或一個類不能被繼承
Original:
Specifies that a 虛函數 can not be overridden in a derived class or that a class cannot be inherited
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目錄

[编辑] 語法

function_declaration final ;
class class_name final base_classes

[编辑] 解釋

使用時,在一個虛擬的函數聲明,final指定的功能可能無法派生類中重寫.
Original:
When used in a virtual function declaration, final specifies that the function may not be overridden by derived classes.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
final是一個具有特殊意義的一個成員函數的聲明或類頭在使用時的標識符。在其他情況下,它是沒有保留,並且可以使用名稱的對象和功能.
Original:
final is an identifier with a special meaning when used in a member function declaration or class head. In other contexts it is not reserved and may be used to name objects and functions.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 為例

struct A
{
    virtual void foo() final;
};
 
struct B final : A
{
    void foo(); // Error: foo cannot be overridden as it's final in A
};
 
struct C : B // Error: B is final
{
};

[编辑] 另請參閱