PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Reason
  • Correction
  • Example
  • Using a protected member in the click code of a button
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 1008: The member of the class is protected
Reason
You are trying to access a protected member of the class from a code other than a code of the class or derived class.
Reminder: A protected member can be handled from the code of the class or from the code of a class derived from this class.
Correction
Two possibilities:
  • Replace the protected member by:
    • A constant protected member: The value of the member can be read and modified from inside the class and the value of the member can be read from a derived class. The access to the member will be forbidden from any other section of the code.
    • A constant public member: The value of this member can be read and modified from inside the class or from a derived class. You will only be able to read the value of the member from any other section of the code.
    • A public member: The access to the member will not be restricted.
  • Don't handle this protected member from one of the project codes.
Example

Using a protected member in the click code of a button

Code triggering the error
// -- Declare the class
Drawing is Class
PROTECTED
BaseColor is int  // Color
END

// -- Click code of a button
IF Drawing::BaseColor = LightRed THEN
...
Possible correction
Use a constant public member.
// -- Declare the class
Drawing is Class
PUBLIC CONSTANT
BaseColor is int  // Color
END

// -- Click code of a button
IF Drawing::BaseColor = LightRed THEN
...
Minimum required version
  • Version 0
This page is also available for…
Comments
Click [Add] to post a comment