Informix Error -4057: A class cannot be derived from a class with PRIVATE intrinsic functions.
Cause and resolution
A class cannot be derived from a class with PRIVATE intrinsic functions.
This statement declares a new class with a DERIVED FROM clause. However, the specified base class has one or more intrinsic functions (class constructor, function such as !copy()) that are declared PRIVATE. The intrinsic functions of a base class must be available for calling from within the same functions of the derived class. Private members cannot be called so; therefore, you cannot derive a class from a base class with private intrinsic functions. Make sure that you specified the correct base class, and review its declaration.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4057 fires when a DERIVED FROM clause names a base class whose intrinsic functions (the
constructor, or a function like !copy()) are declared PRIVATE — per the official guidance,
a derived class's own intrinsic functions must be able to call the base class's intrinsic
functions, which PRIVATE access prevents.
- The specified base class has one or more
PRIVATEintrinsic functions, per the official guidance — the direct, only cause.
Solutions / Resolution
- Make sure the correct base class was specified, per the official guidance.
- Review the base class's declaration and change its intrinsic functions' access level if inheritance is genuinely intended, per the official guidance.
Examples
Deriving from a class with a PRIVATE constructor
CLASS Base
FUNCTION PRIVATE Base()
...
END FUNCTION
END CLASS
CLASS Derived DERIVED FROM Base
-- -4057: Base's constructor is PRIVATE
...
END CLASS
Corrected
CLASS Base
FUNCTION PROTECTED Base()
...
END FUNCTION
END CLASS
Diagnostic Checks
- Check the intended base class's intrinsic functions for
PRIVATEaccess, and confirm the correct base class was named, or adjust its access level.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -4057 in this set yet.
The intended base class has PRIVATE intrinsic functions, which a derived class can't call —
confirm the base class or adjust its access level.