Share via


Finding the Base Class of a Function with Phoenix

This came up on an internal alias today, so I thought I would post the solution.

 The issue is when there is some code like the following:

    class BaseClass

    {

    }

    class InheritedClass : BaseClass

    {

        void SomeFunction() { }

    }

And you have a pointer to the SomeFunction function unit, how do you find out the associated base class of that function (in this case it is BaseClass).

The answer is: 

functionSymbol.EnclosingAggregateType.PrimaryBaseAggregateType

Comments

  • Anonymous
    October 08, 2007
    PingBack from http://www.artofbam.com/wordpress/?p=6266

  • Anonymous
    October 10, 2007
    Naming them FunctionSymbol.DeclaringType.BaseType too concise?

  • Anonymous
    October 26, 2007
    Yes, yes.  We know that some things are a bit more verbose than they should be.