CMS Snapshot Analysis - Run Analyzer - DOTNet - Information - How to find out the list of ancestors of a class


Ancestors can be interfaces implemented by the class, or parent classes extended by the class. This page explains how to list the ancestors of a class.

Applicable in CAST Version


Applicable RDBMS
How to find out the list of ancestors of a class

HOW To find out the list of ancestors of a class

Open the source file and look if the class implements some interface. It is the case if the class declaration contains the : (colon) symbol.

Interface Implementation
class Child : IChild, ISomeOtherInterface {

In this example, class Child implements two interfaces : IChild and ISomeOtherInterface. Add both Interfaces to your list.

If the class inherits some parent class, then you also have to find out the interfaces implemented by the parent class.
The class inherits a parent class if the class declaration also the : (colon) symbol.

Class Inheritance
class Parent  : IChild, ISomeOtherInterface {
class Child : Parent

In this example: add class Parent and interfaces IChild and ISomeOtherInterface to your list.

To find out the location of the Parent source file, look for it in Enlighten Object Browser and add it to your view. Typing F12 will tell you about the source file in the properties view

Interface Implementation (parent class source file)
class Parent : IParentInterface {

In this example, you also have to add interface IChildParentInterface in your interface list.

Of course, if interface IParentInterface extends another interface like below, you have to proceed recursively until you encounter no more : (colon) symbol.

Recursive Inheritance
interface IParentInterface : IGrandParentInterface { 
Example below:
public interface IScanner
    void Scan();

public interface IPrinter
    void Print();
public interface IPhotocopier : IScanner, IPrinter
    void Copy();
Above example is a short example of recursive Inheritance of interfaces.

Add interface IGrandParentInterface to your list

At this stage, your list contains {Child, IChild, ISomeOtherInterface, Parent, IParentInterface, IGrandParentInterface} . To be continued recursively.

Related Pages