Tuto WINDEV 25

426 Part 7: Advanced programming Concepts The Object-Oriented Programming (OOP) is designed for better code reusability. The programs developed in OOP are structured: they include modules, each one managing a software feature. These modules can easily be re-used in other software. They group a set of procedures (called methods) and they encapsulate the data structure on which the methods will act. To use the object-oriented programming, you must declare the classes, the members and the associated methods. The classes A class contains the description of a data structure (the members) and the procedures (methods) that handle the members. Therefore, a class defines a type of data and its behavior. The objects A class is used to create objects . Each created object owns the members described in its class and it can be handled via the methods of its class. An object is defined as a class instance. When the class is declared, all you have to do is associate an object with a class in order for the object to be handled by all methods of this class. The members A member is a data (or parameter) of the object. The methods A method is used to act on the object, to modify its members for example. A method is a procedure. Its operating mode is similar to the one of standard WLanguage procedures. Concept of inheritance The inheritance is used to include the characteristics of an existing class (base class) into a new class (derived class). The inheritance allows you to create a new data type from a known type in order to add features to it or to modify its behavior. Therefore, the base class will not be modified. A class can inherit from a class: it becomes a sub-class of this class. The objects found in a derived class can access all methods, all members and all properties of ancestor classes ; it is as if the methods, the members and the properties of ancestor classes were part of the derived class.

RkJQdWJsaXNoZXIy NDQ0OA==