Informix Error -4020
-4020 Function "member" is not a member of class "class".
This statement tries to invoke class::member(), either directly or as object.member(). However, no such member function is available from that class. Check the spelling of the member name and the class or object name. If the reference is class::member(), review the declaration of the class for the correct spelling of the names of its members. If the reference is through an object, make sure the object is declared as having the class you intended. You can only call members of the stated class (the class it is declared to have) of an object. If you want to call a member of an actual class (the class that you think will be present at execution time), use the CAST operator.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4020 fires when code tries to invoke class::member() or object.member() but no such
member function exists on that class — per the official guidance, you can only call members of
an object's stated class (the class it's declared to have), not necessarily its actual
runtime class.
- A misspelled member or class/object name, per the official guidance — the first named cause.
- Calling through an object declared with a different class than intended, per the official guidance — the second named cause.
- Trying to call a member of the object's actual (runtime) class rather than its stated
(declared) class, per the official guidance — a named cause requiring the
CASToperator instead.
Solutions / Resolution
- Check the spelling of the member name and the class or object name, per the official guidance.
- For
class::member(), review the class declaration for the correct member spelling, per the official guidance. - For
object.member(), confirm the object is declared as having the intended class, per the official guidance. - To call a member of the object's actual class rather than its stated class, use the
CASToperator, per the official guidance.
Examples
Calling a member not present on the object's stated class
DEFINE o BaseClass
LET x = o.derivedOnlyMethod()
-- -4020: derivedOnlyMethod is not a member of BaseClass
Corrected, using CAST for the actual class
LET x = CAST(o AS DerivedClass).derivedOnlyMethod()
Diagnostic Checks
- Check the spelling of the member and class/object names, and whether the member exists
on the object's stated (declared) class, using
CASTif the actual class is different.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -4020 in this set yet.
The named member function doesn't exist on the class as stated — check spelling and object
declaration, or use CAST to reach a derived class's members.