Examples of using Initializer in English and their translations into Chinese
{-}
-
Political
-
Ecclesiastic
-
Programming
This initializer would not be legal:.
With username, designated initializer.
The initializer must have storage to initialize.
Every class must have at least one designated initializer.
This convenience initializer cannot yet modify any properties.
Scope of the second'x' begins before the initializer(= x).
An initializer specifies the initial value stored in an object.
At most one variantmember can have a default member initializer.
This initializer is therefore inherited by RecipeIngredient.
At most one variantmember can have a default member initializer.
If initializer is absent, each element is default-initialized.
Yet in many cases, an object's declaration includes an initializer.
The example below uses the initializer to try to convert a String into an Int:.
Nearly every local variable declaration should contain an initializer.
This initializer can be used to create a new Food instance with a specific name:.
Specifically, it declares a name property of type String,and an init name initializer.
The explicitly typed initializer idiom forces auto to deduce the type you want it to have.
Until C++11,aggregate initialization could not be used in a constructor initializer list due to syntax restrictions.
An anonymous object initializer declares an anonymous type and returns an instance of that type.
The Food class does not have a superclass, and so the init(name:String) initializer does not need to call super.
Because initializer_list is a real type, it can be used in other places besides class constructors.
The order of evaluation of subexpressions in an array initializer is indeterminately sequenced in C(but not in C++ since c++11):.
This initializer simply assigns the origin and size argument values to the appropriate stored properties:.
If it doesn't, the new value the convenience initializer assigns will be overwritten by its own class's designated initializer.
An instance initializer is simply a block of code inside the body of a class, but outside of any methods or constructors.
You can provide initialization parameters as part of an initializer's definition, to define the types and names of values that customize the initialization process.
This will call the initializer list constructor, not the constructor of std::vector that takes a single size parameter and creates the vector with that size.
Therefore, the names and types of an initializer's parameters play a particularly important role in identifying which initializer should be called.
The init(center: size:) initializer could have assigned the new values of origin and size to the appropriate properties itself.