Informix Error -4036: Function "name" cannot be redefined in a derived class "class" with different scope of reference.
Cause and resolution
Function "name" cannot be redefined in a derived class "class" with different scope of reference.
The base class of the function "name" is declared as SHARED and "name" is not, or "name' is declared as SHARED and its base class is not.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4036 fires when a derived class redefines an inherited function with a different SHARED
status than its base class declared — per the official guidance, either the base class's
function is SHARED and the redefinition isn't, or vice versa.
- A redefined function's
SHAREDstatus doesn't match its base-class declaration, per the official guidance — the direct, only cause.
Solutions / Resolution
- Match the redefined function's
SHAREDstatus to its base-class declaration.
Examples
A mismatched SHARED status on override
CLASS Base
FUNCTION SHARED nextId()
...
END FUNCTION
END CLASS
CLASS Derived DERIVED FROM Base
FUNCTION nextId()
-- -4036: Base declares nextId() SHARED, this redefinition isn't
END FUNCTION
END CLASS
Corrected
CLASS Derived DERIVED FROM Base
FUNCTION SHARED nextId()
...
END FUNCTION
END CLASS
Diagnostic Checks
- Check the base class's
SHAREDstatus for the function being redefined, and match it in the derived class.
Related Errors / Related Topics
- -4035 — "Function "name" cannot be redefined in a derived class "class" with different
access permissions." A related function-redefinition error, about mismatched access
permission rather than mismatched
SHAREDness.
A redefined function's SHARED status doesn't match its base class's declaration — make them
match.