Variant is a data type in certain programming languages, particularly Visual Basic, OCaml, and C++ when using the Component Object Model. In Visual Basic (and Visual Basic for Applications) the Variant data type is a tagged union that can be used to represent any other data type (for example, integer, floating-point, single- and double-precision, object, etc.) except fixed-length string type and record types. In Visual Basic, any variable not declared explicitly or the type of which is not declared explicitly, is taken to be a variant.

Property Value
dbo:abstract
  • Variant is a data type in certain programming languages, particularly Visual Basic, OCaml, and C++ when using the Component Object Model. In Visual Basic (and Visual Basic for Applications) the Variant data type is a tagged union that can be used to represent any other data type (for example, integer, floating-point, single- and double-precision, object, etc.) except fixed-length string type and record types. In Visual Basic, any variable not declared explicitly or the type of which is not declared explicitly, is taken to be a variant. While the use of not explicitly declared variants is not recommended, they can be of use when the needed data type can only be known at runtime, when the data type is expected to vary, or when optional parameters and parameter arrays are desired. In fact, languages with a dynamic type system often have variant as the only available type for variables. Among the major changes in Visual Basic .NET, being a .NET language, the variant type was replaced with the .NET object type. There are similarities in concept, but also major differences, and no direct conversions exist between these two types. For conversions, as might be needed if Visual Basic .NET code is interacting with a Visual Basic 6 COM object, the normal methodology is to use .NET marshalling. In unrelated usage, variant type is also used to refer to an algebraic data type (comparable to a tagged union), whose constructors are often called variants. In languages such as OCaml and Haskell, this kind of variant type is the standard language building block for representing many data structures. (en)
  • 不定型別是目前程式語言中所擁有的一種資料型別,常用於Visual Basic及C++中。 在Visual Basic(及Visual Basic for Applications)中,不定型別是一種標籤聯合,用以表達任何一種資料型別(例如整數、雙精度及單精度浮點數、物件等等),除了固定長度字串或結構體。任何在Visual Basic中並未明確指定資料型別的變數,也會被當成不定型別來進行處理。 儘管不明確地宣告變數型別是一個不太好的習慣,但當一個資料的類型只有在執行時期才能被確定時,它就顯得相當的有用。實際上一部份動態型別的程式語言裡,通常就只有不定型別這一種資料型別。 在Visual Basic.NET裡,因為物件導向概念被引入,所以不定型別被.NET的Object型態所取代。Object型態和不定型別在概念上很相似,但卻大大不同,而且無法互相轉換。當Visual Basic.NET需要與Visual Basic的COM物件互動,通常需要先透過.NET的一些程式進行轉換。 (zh)
dbo:wikiPageExternalLink
dbo:wikiPageID
  • 9731827 (xsd:integer)
dbo:wikiPageRevisionID
  • 737576285 (xsd:integer)
dct:subject
http://purl.org/linguistics/gold/hypernym
rdfs:comment
  • 不定型別是目前程式語言中所擁有的一種資料型別,常用於Visual Basic及C++中。 在Visual Basic(及Visual Basic for Applications)中,不定型別是一種標籤聯合,用以表達任何一種資料型別(例如整數、雙精度及單精度浮點數、物件等等),除了固定長度字串或結構體。任何在Visual Basic中並未明確指定資料型別的變數,也會被當成不定型別來進行處理。 儘管不明確地宣告變數型別是一個不太好的習慣,但當一個資料的類型只有在執行時期才能被確定時,它就顯得相當的有用。實際上一部份動態型別的程式語言裡,通常就只有不定型別這一種資料型別。 在Visual Basic.NET裡,因為物件導向概念被引入,所以不定型別被.NET的Object型態所取代。Object型態和不定型別在概念上很相似,但卻大大不同,而且無法互相轉換。當Visual Basic.NET需要與Visual Basic的COM物件互動,通常需要先透過.NET的一些程式進行轉換。 (zh)
  • Variant is a data type in certain programming languages, particularly Visual Basic, OCaml, and C++ when using the Component Object Model. In Visual Basic (and Visual Basic for Applications) the Variant data type is a tagged union that can be used to represent any other data type (for example, integer, floating-point, single- and double-precision, object, etc.) except fixed-length string type and record types. In Visual Basic, any variable not declared explicitly or the type of which is not declared explicitly, is taken to be a variant. (en)
rdfs:label
  • Tipo variante (es)
  • Variant type (en)
  • 不定型別 (zh)
owl:sameAs
prov:wasDerivedFrom
foaf:isPrimaryTopicOf
is dbo:wikiPageDisambiguates of
is foaf:primaryTopic of