ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / OOP (Object Oriented Programming)
  • Overview
  • Syntax
  • Declaring a dynamic object
  • Instantiating a dynamic object
  • Freeing a dynamic object
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Dynamic instantiation of a .NET object
Overview
A .NET object can be dynamically associated with a .NET class, in which case the object is dynamically instantiated.
Instantiating a dynamic .NET object allows you to create an object at a given time and to free this object when it is no longer used.
To instantiate a .NET object, you must:
  1. declare a dynamic .NET object
  2. instantiate the .NET object
Remark: The object is automatically released when it is no longer used at the end of the application.. However, you can force the object destruction (to trigger the destructor execution for example).
Syntax

Declaring a dynamic object

<Nom Objet> est [un] [objet] <Nom Classe> dynamique
Details of syntax
<Object Name>
Name used to identify the instance of the .NET class.
<Class Name>
Name identifying the class. If the .NET class is named like a WLanguage keyword, the name of the class must be enclosed in quotes (for example, o is "<Class>"(<Parameters>).

Instantiating a dynamic object

<Nom Objet> = allouer un <Nom Classe>([<Paramètres>])
Details of syntax
<Object Name>
Name used to identify the instance of the .NET class.
<Class Name>
Name identifying the class. If the .NET class is named like a WLanguage keyword, the name of the class must be enclosed in quotes (for example, o is "<Class>"(<Parameters>).
<Parameters>
Optional parameters of constructor.

Freeing a dynamic object

libérer <Nom Objet>
Details of syntax
<Object Name>
Name that identifies the instance of the class.
Remarks:
  • The object is automatically freed at the end of the application when it is no longer used. However, you can force the object destruction (to trigger the destructor execution for example).
  • To check whether a dynamic object is allocated and whether it was not freed yet, this object must be compared to NULL. Example:
    SI <Nom Objet> = NULL ALORS ...

    SI <Nom Objet> <> NULL ALORS ...
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/21/2024

Send a report | Local help