共用方式為


Terms

C++ terms used in this book are defined in the following table:

C++ Terminology

Term

Meaning

Declaration

A declaration introduces names and their types into a program without necessarily defining an associated object or function. However, many declarations serve as definitions.

Definition

A definition provides information that allows the compiler to allocate memory for objects or generate code for functions.

Lifetime

The lifetime of an object is the period during which an object exists, including its creation and destruction.

Linkage

Names can have external linkage, internal linkage, or no linkage. Within a program (a set of translation units), only names with external linkage denote the same object or function. Within a translation unit, names with either internal or external linkage denote the same object or function (except when functions are overloaded). (For more information on translation units, see Phases of Translation), in the Preprocessor Reference.) Names with no linkage denote unique objects or functions.

Name

A name denotes an object, function, set of overloaded functions, enumerator, type, class member, template, value, or label. C++ programs use names to refer to their associated language element. Names can be type names or identifiers.

Object

An object is an instance (a data item) of a user-defined type (a class type). The difference between an object and a variable is that variables retain state information, whereas objects can also have behavior.

This manual draws a distinction between objects and variables: "object" means instance of a user-defined type, whereas "variable" means instance of a fundamental type.

In cases where either object or variable is applicable, the term "object" is used as the inclusive term, meaning "object or variable."

Scope

Names can be used only within specific regions of program text. These regions are called the scope of the name.

Storage class

The storage class of a named object determines its lifetime, initialization, and, in certain cases, its linkage.

Type

Names have associated types that determine the meaning of the value or values stored in an object or returned by a function.

Variable

A variable is a data item of a fundamental type (for example, int, float, or double). Variables store state information but define no behavior for how that information is handled. See the preceding list item "Object" for information about how the terms "variable" and "object" are used in this documentation.

See Also

Reference

Basic Concepts