PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Error caption
  • Explanations
  • Example 1
  • Example 2
  • Solutions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Error: Redefinition of syntax
Error caption
The '<method>' methods of the '<derived class>' class and of the '<base class>' class do not have the same prototype. The compiler cannot solve the ambiguity between a redefined method and a multi-syntax method.
Explanations
This error is caused when using different syntaxes for a method with the same name found both in a base class and in a class derived from the base class.
Indeed, when a method found in the base class and in the derived class does not have the same prototype, the compiler cannot decide:
  • whether it is an error in the existing code.
  • whether the expected behavior is a redefinition of the method. The redefinition of method was available in the earlier versions.
  • whether the expected behavior is an additional syntax for the method (new feature in version 16).
For a redefined method, the manipulation of an instance of the derived class always runs the methods of the derived class.
For a method that uses different prototypes (multi-syntax), the execution will use the best syntax found according to the specified parameters.
The redefinition of method and the use of a multi-syntax method are written in the same way in the code editor.
To avoid this ambiguity, the compiler displays this error in order to get a clearer code.

Example 1

A derived class is defined. This class also uses a method named "Method1" but with a different prototype: the type of the parameter is different. In this case, the compilation error is displayed.

Example 2

A derived class is defined. This class also uses a method named "Method2" but with a different prototype: "Method2" of the base class expects no parameter and "Method2" of the derived class expects 2 parameters. In this case, the compilation error is displayed.
Solutions
Three cases may occur:
  • 1st case: It is an error: the two methods should have the same prototype.
    Solution: Correct the prototypes
  • 2nd case: The redefinition of the method with a different prototype was done on purpose.
    This operating mode corresponds to the default operating mode until version 15.
    • Solution 1: Add the attribute whose extension is <override> to the method of the derived class.
      PROCEDURE method([<Parameters>]) <override>
    • Solution 2: Rename the method of the derived class.
  • 3rd case: The method of the derived class must be considered as being an additional syntax of the method of the base class (use of multi-syntax)
    Solution: Add the attribute whose extension is <overload> to the method of the derived class.
    See Managing the overload for more details.
    PROCEDURE method([<Parameters>]) <overload>
Minimum required version
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment