JavaScript Editor js editor     Web development 



Main Page

To gain more control over your code, make coding easier and less vulnerable to errors, and make IntelliSense functionality available for visual objects, class references, ActiveX controls, COM servers, and user-defined code elements, use strong typing. OLEPUBLIC type libraries also use strong typing.

Note:
Visual FoxPro is not a strongly typed language and does not require that you declare variables with a specific data types. Visual FoxPro does not enforce strong typing at design time or run time.

For more information, see IntelliSense Support in Visual FoxPro.

To implement strong typing

  • For objects, method parameters, and values, use the AS clause in the DEFINE CLASS command.

-OR-

When you use the AS clause in code, IntelliSense displays a drop-down list of available types, including types from the following sources:

  • Visual FoxPro object base classes.

  • Visual FoxPro data types.

The following example uses the AS clause in the DEFINE CLASS command to implement strong typing for the custom OLEPUBLIC class and the method MyMethod:

В Copy Code
DEFINE CLASS MyClass1 AS Custom OLEPUBLIC
   FUNCTION MyMethod (MyParam1 AS integer, MyParam2 AS string) AS integer
      RETURN MyParam1 
   ENDFUNCTION
ENDDEFINE

The following example uses the AS clause in the LOCAL, PUBLIC, LPARAMETERS, PARAMETERS, and FUNCTION commands to implement strong typing:

В Copy Code
LOCAL oExcel AS "excel.application"
oExcel = CREATEOBJECT("excel.application")
oExcel.   && Displays a list of members.

PUBLIC ARRAY MyArray[2] AS _form OF ffc\_base
LPARAMETERS MyParam1 AS String OF _Base.vcx
PARAMETERS MyParam1 AS Custom OF MyBase.vcx
FUNCTION MyFunction AS Custom

See Also



JavaScript Editor js editor     Web development