ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / OOP (Object Oriented Programming)
  • Class
  • Object
  • Constructor and destructor
  • Inheritance
  • Data encapsulation
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Class
A class contains the description of a data structure (members) and the processes (methods) that handle this structure.
Therefore, a class defines a type of data and its behavior.
For more details, see The classes.
Object
A class is used to create objects. Each created object owns the members described in its class and can be manipulated via the methods of its class. An object is defined as "an instance of the class".
A class can be considered as being a model that defines the members and methods common to several objects.
A member is a parameter of the object. A method is used to act on the object, to modify its members for example.
For more details, see The objects.
Constructor and destructor
The notion of Constructor and Destructor is important because it involves an automatic call to a method when creating or destroying an object.
  • The Constructor method associated with a class is automatically called when declaring an object of the class. This is used to make sure that the initialization processes of the object (assignment of members for example) will not be forgotten by the developer.
  • The Constructor method associated with a class is automatically called when deleting the object (exit the procedure where the object was declared). This allows you to free the resources used by the object without fear of oversight (memory area for example). It can also be used to update a file related to the object.
For more details, see Constructor and Destructor.
Inheritance
Inheritance makes it possible to include the characteristics of an existing class (base class) into a new class (derived class). This allows you to create a new type of data from a known type, in order to add features or to modify its behavior. Therefore, the base class will not be modified. A class can inherit from one or more classes ; it becomes a sub-class of this class.
A derived class inherits the members and methods of its parent classes, in addition to its own members and methods. There is no need to duplicate the members and methods of the parent classes.
For more details, see Class inheritance.
Data encapsulation
The data encapsulation is probably the most important notion in OOP. This technique is used to ensure that the data members of the object will not be wrongly modified by some functions (methods) external to the object. This allows you to prevent the user of an object from accessing some or all of its members. The members whose access is forbidden are called private members.
They can only be accessed from some specific methods of the class.
Related Examples:
WD Simple OOP Training (WINDEV): WD Simple OOP
[ + ] The "WD Simple OOP" example is an educational example about the OOP with WINDEV. This example presents the operating mode of:
- classes,
- inheritances,
- virtual procedures,
- UML diagrams,
- ...
WD Controlling word processor Training (WINDEV): WD Controlling word processor
[ + ] The purpose of this example is to propose a universal interface, allowing to control these applications without having to worry about the application to control. This example is based on an object-oriented programming concept: the polymorphism. It consists in using different objects (OpenOffice object and Microsoft Word object) without really knowing which one is used.
WD Graphic Objects Training (WINDEV): WD Graphic Objects
[ + ] This example illustrates the power of WLanguage in object oriented programming.
This example is a graphic object editor.

It is possible to:
- move, resize objects
- make selections with a lasso or a mouse
- cut/copy/paste objects
- delete/duplicate objects
- save the created documents and print them.

The main technical features presented and documented are:
- management of an object clipboard
- UNDO/REDO management
- serialization and deserialization of objects
- algorithms for managing graphic objects (proportional resizing, management of move rules, etc...)
WD Controlling Outlook Training (WINDEV): WD Controlling Outlook
[ + ] This program, powered by WINDEV, is used to read and write in the Outlook folders:
- Email
- Calendar
- Contacts
- Tasks
- Notes

An OLE dialog is used to read and write data in the Outlook files.
Note: We will be using the Outlook software supplied with the later versions of MS-Office. The software used is not "Outlook express".

"WD Controlling Outlook" also presents an example for using the WINDEV databinding between the variables found in the code and in the controls.

This example also presents the OOP (Object-Oriented Programming) and the UML diagrams.
WD Flowchart Training (WINDEV): WD Flowchart
[ + ] This example is used to create organization charts.
An organization chart is used to indicate the repartition of the managers within a company and the relationships that exist between these managers.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/18/2024

Send a report | Local help