MSIR.0883 Class (classname) -- inherited classes (classname) and (classname) contain members with the same name: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "A class that extends at least two base classes, both of which were qualified with the <tt>Inherit</tt> keyword in the <tt>Extends</tt> clause, inherited the same named member fro...")
 
(Automatically generated page update)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
A class that extends at least two base classes, both of which were qualified with the <tt>Inherit</tt> keyword in the <tt>Extends</tt> clause, inherited the same named member from both base classes. <li>th Other than fixing the method names in the base classes, there are two ways to correct this problem:
A class that extends at least two base classes, both of which were qualified with the <var>Inherit</var> keyword in the <var>Extends</var> clause, inherited the same named member from both base classes. Other than fixing the method names in the base classes, there are two ways to correct this problem:
<ul>
<li>Add the <var>IgnoreDuplicates</var> keyword after the <var>Inherit</var> keyword for the second base class in the <var>Extends</var> clause.
<p>
This is not highly recommended, because it could mask future conflicts caused by adding a method to the first base class with the same name as the one in the second base class. In such a case, the new method in the first base class will preempt the method in the second, even though the second was formerly used. If you are lucky, a compile error will flag the problem. If unlucky, the application will silently do the wrong thing. </p></li>


<ul> <li>Add the <tt>IgnoreDuplicates</tt> keyword after the <tt>Inherit</tt> keyword for the second base class in the <tt>Extends</tt> clause. This is not highly recommended, because it could mask future conflicts caused by adding a method to the first base class with the same name as the one in the second base class. In such a case, the new method in the first base class will preempt the method in the second, even though the second was formerly used. If one is lucky, a compile error will flag the problem. If unlucky, the application will silently do the wrong thing. <li>Explicitly Inherit the conflicting name using the <tt>Inherit</tt> statement in the Public block. This is the recommended approach.</ul>
<li>Explicitly Inherit the conflicting name using the <var>Inherit</var> statement in the <var>Public</var> block. This is the recommended approach.</li>
</ul>


[[Category:Sirius Mods Messages]]
{{Template:MSIR.0883 footer}}
[[Category:MSIR.0800 - MSIR.0999]]

Latest revision as of 23:36, 3 March 2017

A class that extends at least two base classes, both of which were qualified with the Inherit keyword in the Extends clause, inherited the same named member from both base classes. Other than fixing the method names in the base classes, there are two ways to correct this problem:

  • Add the IgnoreDuplicates keyword after the Inherit keyword for the second base class in the Extends clause.

    This is not highly recommended, because it could mask future conflicts caused by adding a method to the first base class with the same name as the one in the second base class. In such a case, the new method in the first base class will preempt the method in the second, even though the second was formerly used. If you are lucky, a compile error will flag the problem. If unlucky, the application will silently do the wrong thing.

  • Explicitly Inherit the conflicting name using the Inherit statement in the Public block. This is the recommended approach.


Message attributes:

RETCODEO=0Sets online return code
RETCODEB=4Sets batch (single user) return code
CLASS=EError class; the message can be suppressed with the X'04' bit setting of the MSGCTL parameter
AUDITERWrites the message with line type ER to the audit trail
COUNTIncrements the error count (ERCNT) parameter
ECHODisplays the line that caused the error

Back to list of messages