Using value typesover reference types in Swift is easier than ever before in Objective-C, making your code more expressive and less error-prone.
之后,我们会向你展示如何将一个引用类型封装到结构体里,这样我们就能够把它当作一个值类型来使用。
After that, we will demonstrate how to wrap a reference type in a struct in order to use it as an efficient value type..
Delegate用于声明一个引用类型,该引用类型可用于封装命名方法或匿名方法。
Delegate- Refers to a reference type that is used to encapsulate a named or anonymous method.
支持引用类型专用的基于堆栈的符号,也就是说其生命期与其声明的范围相关联。
A special stack-based notation for a reference type is supported; that is, one in which its lifetime is associated within the scope of its declaration.
引用类型不包含存储在变量的实际的数据,但它们包含一个引用的变量。
The reference types do not contain the actual data stored in a variable, but they contain a reference to the variables.
上面代码中,调用括号左侧是引用类型(因为foo是标识符):.
We see that on the left hand side of call parentheses there is a Reference type value(because foo is an identifier).
若转型失败且new_type是引用类型,则它抛出匹配类型std::bad_cast处理块的异常。
If the cast fails and new_type is a reference type, it throws an exception that matches a handler of type std::bad_cast.
当应用于引用类型时,其结果是被引用类型的大小。
When applied to a reference type, the result is the size of the referenced type..
C-类型必须是引用类型,以便在通用类型或方法中将其用作参数“T”.
The type‘int' must be a reference type in order to use it as parameter‘T' in the generic type or method‘Lesson'.
中文
Bahasa indonesia
日本語
عربى
Български
বাংলা
Český
Dansk
Deutsch
Ελληνικά
Español
Suomi
Français
עִברִית
हिंदी
Hrvatski
Magyar
Italiano
Қазақ
한국어
മലയാളം
मराठी
Bahasa malay
Nederlands
Norsk
Polski
Português
Română
Русский
Slovenský
Slovenski
Српски
Svenska
தமிழ்
తెలుగు
ไทย
Tagalog
Turkce
Українська
اردو
Tiếng việt