Swift structures and classes

Swift structure

In Swift standard, the vast majority of types of structures are disclosed, and enumerated classes, and only a small portion of the

 For example Bool, Int, Double, String, Array, Dictionary and other common types are structures

Swift definition of a structure

 All structures are automatically generated by a compiler compiler will initializer, the initializer may be generated as a plurality of structure

Aim is to ensure that all members of the initialization structure has an initial value

Person structure is defined, the compiler automatically generates the initializer

Create an instance of the structure Person

Once the custom custom initializer structure, the compiler does not generate other automatically upload the initializer

 

Guess you like

Origin www.cnblogs.com/CoderHong/p/11256898.html