Comparison of keywords in different languages

xiaoxiao2021-03-06  15

Comparison of keywords in different languages

This topic lists the general programming tasks that can be outlined with a language keyword. For more information on tasks that require code samples, see Using Code Examples Compare the programming concepts in different languages.

The purpose Visual BasicVisual J # C C # NEW JScriptVisual FoxPro declare variables tabindex = "0" keywords = "vastmDim"> Private, Public, Friend, Protected, Static1, Shared, Dimpublic, private, protected static, final, volatile, transient tabindex = "0" Keywords = "_ CLANG_Declarators_and_variable (concept, not a keyword) declare (keywords include user-defined types and built-in types) TabINDEX =" 0 "keywords =" jsstmvar "> var [implicit statement] ; or PUBLIC, LOCAL, PRIVATE statement named constants tabindex = "0" keywords = "vastmConst"> Constfinal tabindex = "0" keywords = "_ langref_const"> const tabindex = "0" keywords = "vclrfConstPG"> const tabindex = "0" keywords = "vclrfReadonlyPG"> readonly tabindex = "0" keywords = "jsstmconst"> const nEW #DEFINE create a new object tabindex = "0" keywords = "vakeyNew"> Newnew tabindex = "0" keywords = "_ pluslang_new_Operator" > new tabindex = "0" keywords = "vclrfnewoppg"> New TabINDEX = "0" keywords = "jsoprnew"> new / a TabINDEX = "0" keywords = "vafctCreateObject"> createObject () n / a TabIndex = "0" Keywords = "vclrfc.comptrbasecore"> COCREATEINSTANCE () (for COM object) New activityXObject () createObject; newobject assigns an object to object variable Tabind EX = "0" keywords = "vaoprassign"> = === TabINDEX = "0" keywords = "jsoprassign"> ==; or store function / method does not return value TabINDEX = "0" keywords = "Vastmsub"> Sub2void TabIndex = "0" keywords = "_ langref_void"

> void tabindex = "0" keywords = "vcgrfvoid"> Voidvoidvoid (for COM server) overload function or method (Visual Basic: overloaded process or method) TabINDEX = "0" keywords = "vakeyoverloads"> Overloads New Do not need any language key when this purpose is required) (no language keyword is required) (no language keyword is required) (no language keyword is required) (reach this) Without saying a word keyword purposes) references the current object tabindex = "0" keywords = "vakeyMe"> Me3this tabindex = "0" keywords = "_ pluslang_The_this_Pointer"> this tabindex = "0" keywords = "vclrfThisPG"> this tabindex = "0" keywords = "jsstmthis"> thisthis; thisform is non-virtual call TabINDEX = "0" keywords = "vakeymyclass"> myclassn / amphique: func1 (), where MyClass is a C containing member functions FUNC1 class.

N / A / A / A Retrieves characters TabINDEX = "0" keywords = "VALRFGETCHARFunction"> getchar function new "* (p 10) or P [10], where P is char * [] STR [] 10] The STR here is a string, tabindex = "0" keywords = "jsmthcharat"> Charat, TabINDEX = "0" keywords = "jsmthsubstring"> Substring, TabINDEX = "0" keywords = "jsmthsubstr"> Subst4Substr () statement complex data type (Visual Basic: structure) tabindex = "0" keywords = "vastmStructure"> structure End Structureclass, interface tabindex = "0" keywords = "vcsmpClass"> class, tabindex = "0" keywords = "vcsmpStruct"> struct, tabindex = "0" keywords = "_ pluslang_Unions"> union tabindex = "0" keywords = "vcrefInterface"> __ interface tabindex = "0" keywords = "vcrefStructTypes"> struct, tabindex = "0" keywords = "vcrefTheClassType"> class, tabindex = "0" keywords = "vcrefTheInterfaceType"> interface tabindex = "0" keywords = "jsstmClass"> class, tabindex = "0" keywords = "jsstmInterface"> interface NEW n / a to initialize the object (Constructor) TabINDEX = "0" keywords = "VaconusingConstructorsdestructors"> Sub new () 5 constructor (concept, not keyword) TabINDEX = "0" keywords = "_ pluslang_constructors"> Constructor (concept, not a keyword) constructor Function or system default Type Constructor TabINDEX = "0" Keywords = "JSconCreatingownObjects"> Constructor (Concept, not keyword)

6INIT Event Direct Termination Object N / A ~ ClassNamen / AN / A / A Method Call next to the system before the garbage collection recycling object 7 TabINDEX = "0" keywords = "Vaconfinalizedestructors"> Finalize New (in Visual Basic 6.0) Class_Terminate) Finally Destructor Decoction Funal N / ADESTROY Event Initialize TabINDEX = "0" KEYWORDS = "Vastmdim"> DIM X as long = 5 DIM C as new car (FuelTyPeenum.gas) INT x = 5; // or initialize with constructor C c (10); int x = 5; // initialize the value: int x = 123; // or use the default constructor: int x = new int () TabINDEX = "0" keywords = "jsstmvar"> var x = 5 TabINDEX = "0" keywords = "jsstmvar"> var y: car = new car () n / a acquisition function's address TabIndex = "0" keywords = "VAOPRADDRESSOF"> Addressof (for class members, returning to function) delegate, multicast, / ** @delgate * / tabindex = "0" keywords = "vclRF__delegate"> __ delegate TabINDEX = " 0 "Keywords =" vcrefThedLeGateType "> DELEGATE uses a function name without parentheses N / A callback N / A to pass a function's address to another callback modulator. For example, see TabIndex = "0" Keywords = "CPConusingCallbackFunctions"> Using the callback function. Callback; Callback (IDL Property) N / A / A / A declaration object can be asynchronously modified n / avolatile tabindex = "0" keywords = "_ language tabindex =" 0 "keywords =" vclrfvolatile "> Volatilen / AN / A forced explicit declared variables TabINDEX = "0" keywords = "VastMoptionExPlicit"> Option Explicit Unable. All variables must be declared before use. Not available. All variables must be declared before use. Not available.

(All variables must be declared to use) Quick mode (Open by default) _VFP.LanguageOptions New test Do not reference objects object variable TabINDEX = "0" keywords = "vaconobjvarasign"> Obj = NothingPobj == Nullpobj == nullobj nullobj == undefined obj == nullEMPTY (); ISNULL () value of the referenced object is not tabindex object variable = "0" keywords = "vakeyNothing"> Nothingnulln / a tabindex = "0" keywords = "vclrfNull"> nullnull undefinedn / A Test Database Empty Expression TabINDEX = "0" Keywords = "VAFCTINULL"> ISDBNULL is affected by tabindex = "0" keywords = "fr1rfsystemDataSqltypes> system.data.sqltypes N / A / AX == Nullisnull () Test if the variant variable has been initialized n / an / an / AX == undefinedempty () Define the default attribute TabINDEX = "0" keywords = "VakeyDefault"> default new "n / a tabindex =" 0 "Keywords =" vcerrrusingindexers "> By using the indexer N / A / A object-oriented programming

Objective Visual BasicVisual J # C C # NEW JScriptVisual FoxPro reference to the base class tabindex = "0" keywords = "vakeyMyBase"> MyBase NEW super tabindex = "0" keywords = "vcrefDefault"> __ super tabindex = "0" keywords = "vclrfBasePG "> base tabindex =" 0 "keywords =" jsstmSuper "> super NEW BaseClass attributes; the ParentClass properties; DODEFAULT () interface declaration tabindex =" 0 "keywords =" vastmInterface "> Interface NEW interface tabindex =" 0 "keywords =" vcrefInterface "> __ interface tabindex =" 0 "keywords =" vcrefTheInterfaceType "> interface tabindex =" 0 "keywords =" jsstmInterface "> Interface tabindex interface NEW DEFINE CLASS designated to be achieved =" 0 "keywords =" vastmImplements "> Implements (statement) Implements (clauses only) (only from interface derived) Class C1: public i1class c1: i1 tabindex = "0" keywords = "jsstmclass"> imports new imports new declaration class TabINDEX = "0" keywords = "vastmclass" > class NEW class tabindex = "0" keywords = "vcsmpClass"> class tabindex = "0" keywords = "vcrefTheClassType"> class tabindex = "0" keywords = "jsstmClass"> class NEW DEFINE cLASS Myclass AS Specify a class that can only be inherited. An instance of this class cannot be created.

tabindex = "0" keywords = "vakeyMustInherit"> MustInherit NEW abstract tabindex = "0" keywords = "vclrf__abstract"> __ abstract8 (only in the managed extensions C in) tabindex = "0" keywords = "vclrfAbstract"> abstract tabindex = "0" keywords = "jsrefabstracttattribute"> Abstract New N / A Specifies a class that cannot be inherited.

tabindex = "0" keywords = "vakeyNotInheritable"> NotInheritable NEW final tabindex = "0" keywords = "vchowFinal"> __ sealed (only in the managed extensions C in) tabindex = "0" keywords = "vclrfSealed"> sealed tabindex = "0" keywords = "jsreffinaAlattribute"> Final New N / A declares an enumeration type TabINDEX = "0" keywords = "VastMenum"> Enum end enjoywords = "0" keywords = "_ plusLANG_C.2B2B_. Enumeration_Declarations "> enum tabindex =" 0 "keywords =" vcrefTheEnumerationTypes "> enum tabindex =" 0 "keywords =" jsstmenum "> enum NEW n / a declare a class constant tabindex =" 0 "keywords =" vastmConst "> Conststatic final ( Application to field declaration) TabINDEX = "0" keywords = "_ language"> const tabindex = "0" keywords = "vclrfconstpg"> const (applied to field declaration) TabINDEX = "0" keywords = "jsstmconst"> const new #define From the base class, a class TabINDEX = "0" keywords = "Vastminherits"> Inherits C2 New Class C1 Extends C2Class C1: Public Base (not required this purpose) Class C1: C2 TabINDEX = "0" keywords = "JSSTMCLASS"> Class C1 Extends C2 New Define Class MyClass AS ParentClass Rewriting Method TabINDEX = "0" Keywords = "Vakeyoverrides"> Overrides New (no language keyword is required) (reach this No language keyword is required) TabINDEX = "0" keywords = "vclrfoverridepg"> override (no language keyword is required to achieve this) (no language keyword is required) declared a must be derived Method for implementation in the class TabINDEX = "0" keywords = "vakeymustoverride">

MustOverride NEW abstract = 0 will not need any language key when placed in the end of the statement (pure virtual methods) tabindex = "0" keywords = "vclrfAbstract"> abstract tabindex = "0" keywords = "jsrefAbstractAttribute"> abstract NEW (for this purpose Word) Declare a way to rewrite TabINDEX = "0" keywords = "Vakeynotoverridable"> NOTOVERRIDABLE NEW (By default, the method cannot be rewritten. "

) Final tabindex = "0" keywords = "vchowFinal"> __ sealed (only in the managed extensions C in) tabindex = "0" keywords = "vclrfcsharpspec_10_5_5"> sealed tabindex = "0" keywords = "jsrefFinalAttribute"> final NEW n / a Declare a virtual method, Visual Basic or Property Accessor (C #, C ) TabINDEX = "0" Keywords = "VakeyOverridable"> Overridable (By default, method is virtual) TabINDEX = "0" keywords = " _langref_virtual "> Virtual TabINDEX =" 0 "keywords =" vclrfvirtualpg "> Virtual (By default, method is virtual) N / A hidden base class member TabINDEX =" 0 "keywords =" Vakeyshadows "> Shadowingn / AnWORDS =" VAKEYSHADOWS " / an / a tabindex = "0" keywords = "vclrfneWoppg"> New modifiern / a declares a type of security for a class method TabINDEX = "0" keywords = "vastmdelegate"> delegate new delegate, multicast, / ** @ DELGATE * / TABINDEX = "0" keywords = "vclRF__dlegate"> __ delegate (only in c hosted extension) TabINDEX = "0" keywords = "vcreft-de-itgateType"> Delegate uses a function name without parentheses N / A specified variables Contains an object TabINDEX = "0" keyWords = "VAKEYWITHEVENTS"> WitHEventSn / AN / A (writing code - no specific keyword) EventHandler () Newy specified EventHandler () NEW Event TabINDEX = "0" keywords = "VAKEYHANDLES"> Handles New (event procedure can still be associated with a WitHevents variable with a nameless variable with a nameless.

N / A / A / A / A / A - one - one value of the object expression to access the multiple members TabINDEX = "0" keywords = "VastMwith"> with object <.member> <.member> end with / An / an / a tabindex = "0" keywords = "jsstmwith"> with9with ... Endwith exception handling

Objective Visual BasicVisual J # C C # NEW JScriptVisual FoxPro structured exception handling tabindex = "0" keywords = "vastmTryCatchFinally"> Try NEW Catch Finally End Trytry, catch, finally, throw tabindex = "0" keywords = "_ langref_try_except_Statement"> __ try, __except, tabindex = "0" keywords = "_ langref_try_finally_Statement"> __ finally tabindex = "0" keywords = "vclrfUsingCatchFinallyTogether_PG"> try, catch, finally, tabindex = "0" keywords = "vclrfTheThrowStatement"> throw tabindex = "0" keywords = "jsstmtrycatch"> try, catch, finally, tabindex = "0" keywords = "jsstmThrow"> throwONERROR (), COMRETURNERROR (), ERROR (); MESSAGE (), Aerror () C abnormality N / A / A TabINDEX = "0" keywords = _ pluslang_the_try.2c_.catch.2c_.and_throw_statements> Try, catch, thrown / an / an / a

Decision structure

Purpose Visual Basicvisual J # C C # New JScriptvisual FoxPro Decision Structure (Selection) TabINDEX = "0" Keywords = "VaconusingSelectcase"> Select Case ..., Case, Case, Break, default tabindex = " 0 "keywords =" _ pluslang_The_C.2b2b_.switch_Statement "> switch, case, default, tabindex =" 0 "keywords =" _ pluslang_The_goto_Statement "> goto, tabindex =" 0 "keywords =" _ pluslang_The_C.2b2b_.break_Statement "> break tabindex =" 0 "keywords =" vclrfTheSwitchStatement "> switch, case, default, goto, break tabindex =" 0 "keywords =" jsstmswitch "> switch, case, tabindex =" 0 "keywords =" jsstmbreak "> breakCASE decision structures (IF .. TabINDEX = "0" keywords = "Vaconusingifthen"> if ... Then, elseif ... then, else, endiff, else tabindex = "0" keywords = "_ pluslang_the_c.2b2b_.if_statement"> IF, ELSE TabINDEX = "0" keywords = "vclrftheifstate"> if, else tabindex = "0" keywords = "jsstmif"> if, elseif ... Endif cyclic structure (conditional) TabINDEX = "0" keywords = "VaconusingDoloop"> While, Do [While, Until] ..., loop [while, untric] do, while, continue Tabindex = "0" keywords = "_ pluslang_t he_do_Statement "> do, while, tabindex =" 0 "keywords =" _ pluslang_The_C.2b2b_.continue_Statement "> continue tabindex =" 0 "keywords =" vclrfTheDoStatement "> do, tabindex =" 0 "keywords =" vclrfTheWhileStatementX "> while, tabindex = "0" keywords = "vclrfthecontinuest"> ">

continue tabindex = "0" keywords = "jsconUsingwhileLoops"> do, while, tabindex = "0" keywords = "jsconUsingbreakandcontinueStatements"> break, continueDO, WHILE (clause) cyclic structure (iteration) tabindex = "0" keywords = "vaconUsingForNext ""> For ..., [exit for,] next tabindex = "0" keywords = "VaconusingForeach"> for each ..., [exit for,] nextfor, break tabindex = 0 "keywords =" _ pluslang_the_c.2b2b_. for_Statement "> for tabindex =" 0 "keywords =" vclrfTheForStatement "> for, tabindex =" 0 "keywords =" vclrfTheForeachStatement "> foreach tabindex =" 0 "keywords =" jsconUsingforLoops "> for (x = 0; x <10; x ) {...} TabINDEX = "0" keywords = "jsconusingforinloops"> for (prop in obj) {print (obj [prop]);} for (clause), for ... endfor, continue, next array

Purpose Visual Basicvisual J # C C # new JScriptvisual FoxPro declares a array TabINDEX = "0" keywords = "VacondeclaritingArrays> Dim A () as longint [] x = new int [5]; tabindex =" 0 "Keywords =" _Pluslang_Array "> int x [5]; tabindex =" 0 "keywords =" vclrfarrayspg "> int [] x = new int [5]; tabindex =" 0 "keywords =" jscondeclaritingArrays "> var x: int [], tabindex = "0" keywords = "jscondeclaritingArrays"> var arr = array () Dimension, Declare initializes a array TabINDEX = "0" keywords = "VaconusingArrays> Dim A () as long = {3, 4, 5} int [] X = {1, 2, 3, 4, 5}; tabindex = "0" keywords = "_ pluslang_initializing_arrays"> int x [5] = {1, 2, 3, 4, 5}; tabindex = "0" keywords = "conarrays"> int [] x = new int [5] {1, 2, 3, 4, 5}; tabindex = "0" keywords = "jscondeclaringArrays"> var x: int [] = [1, 2, 3 , 4, 5], tabindex = "0" keywords = "jscondeclaritingArrays"> var arr = new array (1, 2, 3, 4, 5) DIMENSION, DECLAR reassign array TabINDEX = "0" keywords = "Vastmredim"> RedImn / an / an / a tabindex = "0" keywords = "jsprolength"> arr.length = newsing (JScript array only) 10DIMension, Declare class range

Objective Visual BasicVisual J # C C # NEW JScriptVisual FoxPro outside items or assemblies visible tabindex = "0" keywords = "vastmDim"> Publicpublic tabindex = "0" keywords = "_ langref_public"> public tabindex = "0" keywords = "vclrfpublicpg"> public tabindex = "0" keywords = "jsrefpublicttribute"> Public new public in the assembly (C # / Visual Basic) or package (Visual J #, JScript) is not visible to TabINDEX = "0" keywords = "Vastmdim" > Friend (range keyword is omitted, the specified "packet range") tabindex = "0" keywords = "_ langref_private"> private tabindex = "0" keywords = "vclrfInternalPG"> internal tabindex = "0" keywords = "jsrefInternalAttribute"> internal New N / A is only visible in the project (for nested classes, visible in the included class) TabINDEX = "0" keywords = "vastmdim"> privateprivate tabindex = "0" keywords = "_ language"> private TabINDEX = "0 "Keywords =" vclrfprivatepg "> private tabindex =" 0 "keywords =" jsrefprivateattribute "> Private new hidden member range

Purpose Visual Basicvisual J # C C # New JScriptvisual FoxPro Access TabINDEX = "0" KEYWORDS = "Vastmdim"> PublicPublic TabIndex = PublicPublic TabIndex = "0" keywords = "_ language"> public tabindex = "0" keywords = "vclrfpublicpg"> public tabindex = "0" keywords = "jsrefpublicttribute"> Public new public accessible outside the class, but in the project (C #, Visual Basic, C ) or package (Visual J #, JScript) is not accessible to TabINDEX = "0" keywords = "Vastmdim"> Friend (omitted "package" Public private: TabINDEX = "0" keywords = " vclrfinternalpg> INTERNAL TABINDEX = "0" keywords = "jsrefinternalarative"> INTERNAL NEW N / A Only accessible TabINDEX = "0" keywords = "0" keyword "vastmDim"> Privateprivate tabindex = "0" keywords = "_ langref_private"> private tabindex = "0" keywords = "vclrfPrivatePG"> private tabindex = "0" keywords = "jsrefPrivateAttribute"> private NEW HIDDEN only by the current and derived Class Access TabINDEX = "0" Keywords = "VastMdim"> protected new protected tabindex = "0" keywords = "_ langref_protected"> protected tabindex = "0" keywords = "vclrfprotectedpg" > Protected tabindex = "0" keywords = "jsrefProtectedAttribute"> protected NEW PROTECTED specify a function or another class can access the private members of the declaring class n / an / a tabindex = "0" keywords = "_ pluslang_Friends"> friend (in C Not allowed in the hosted extension) N / A / A / A is protected in the assembly,

For other assessments, it is private N / A / APROTECTED Private: (only for c hosted expansion) N / A / A / A miscellaneous survival

Local variables object Visual BasicVisual J # C C # NEW JScriptVisual FoxPro reservation process tabindex = "0" keywords = "vastmDim"> Static11static tabindex = "0" keywords = "_ pluslang_Static"> staticn / an / aPRIVATE owned by a class of examples of shared tabindex = "0" keywords = "vastmDim"> shared NEW static tabindex = "0" keywords = "_ pluslang_Static"> static tabindex = "0" keywords = "vclrfStaticPG"> static tabindex = "0" keywords = "jsrefStaticAttribute" > static new n / a

Miscellaneous

Purpose Visual Basicvisual J # C C # new JScriptvisual FoxPro Note Code TabINDEX = "0" keywords = "vaconcomments"> 'TabINDEX = "0" keywords = "vastmrem"> remote // / *** // ** / Tabindex = "0" keywords = "_ pluslang_c.2b2b_.com"> // / / * / for multi-line comments TabINDEX = "0" Keywords = "vclrfyourfirstcsharpprogram_pg"> // / * * / for multi-line comments / // Used in XML Note TabINDEX = "0" keywords = "jsconcomments"> //, / * * / for multi-line comments *; && Case case? No Yes Whether to call Windows API TabIndex = "0" Keywords = "VastmDeclare"> Declare Call N / A TabINDEX = "0" keywords = "vcwlkplatformInvoketutut"> Use the platform to call N / ADECLARE - DLL declaration and trigger an event TabINDEX = "0" keywords = "vastmevent"> Event, TabINDEX = "0" keywords = "VastMraiseEvent"> raiseEvent Using java.awt.event class or / ** @Event * / n / a tabindex = "0" keywords = "vclrfEventPG"> eventn / an / a thread primitives tabindex = "0" keywords = "vastmSyncLock"> SyncLocksynchronized tabindex = "0" keywords = "vclrfLockStatement"> lockn / an / a to tabindex = "0" keywords = "Vastmgoto"> goton / a TabINDEX = "0" keywords = "_ pluslang_the_goto_state"> goto tabindex = "0" keywords = "vclrfthegotostate"> goton / an / a1. Static can be used by itself to declare variables The only situation (for example, Static X as long) is in the process.

2. In Visual Basic, the process using the SUB keyword declaration cannot return a value. If a process needs to return a value, you must declare it using the function keyword.

3. Do not resolve the ME when compiling, so it can be used as the return value of the attribute or method.

4. Still supporting the substr function, but it is no longer the preferred method of accessing characters in the string. Accessing a characterful way from a specific location in a string is to use parentheses. For example, if you want to access the tenth character in the string STR, use Str [10]. 5. In Visual Basic, the constructor of the class derived from the .NET Framework system.Object is always named New.

6. The constructor is not allowed to be overloaded in JScript.

7. Typically, the code release in this method cannot be automatically released by the garbage collector.

8. In C , an abstract class contains at least one pure virtual member.

9. Note that there is no previous guide number used in Visual Basic. This feature is prone to confusion because the variable may be mistakenly considered attribute, and vice versa. It should also be noted that the WITH statement will generate low-efficiency code.

10. Do not reallocate arrays, and will not "grow". The JScript array (declared Array type) is always a sparse dynamic array. Notell arrays (declared as System.Array or Type []) is not a dynamic array.

11. In Visual Basic, the static partial variable of the non-shared class is stored in each class instance, rather than sharing a copy like in other languages. If a variable is used to declare a variable, the value of the variable remains in the value when the variable is lost and re-obtained.

转载请注明原文地址:https://www.9cbs.com/read-45845.html

New Post(0)