Rule Definition
Referencing down the inheritance tree is against Object-Oriented coding practices. It is a way of having two-way inheritance between class (or interface) and subclass (or subinterface). This is an indication of poor class (or interface) design and class (or interface) inheritance. Such practices increase the complexity of the application.
Remediation
Review the design of the Class hierarchy
Violation Code Sample
C# Sample:
public class MySuperClass
{
public void aMethod() { MySubClass c = null; } // VIOLATION: Reference to a sub class
}
class MySubClass : MySuperClass
{
protected int m_subclassField = 0;
}
Reference
CISQ rule: ASCRM-RLB-14.
Related Technologies
.Net
JEE
Technical Criterion
CWE-1062 - Parent Class with References to Child Class
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.