Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a little bit of dilema here.

I have a hierachical collection of classExtensions that I very much would like to keep them as they are now:

  1. Timestamper (master concrete class Extension) 1.1) BaseCadastralExtension (derives from Timestamper)
  2. Derived classes (from BaseCadastralExtension)

But I want to implement custom IObjectInspectors for each of the derived classes. I can't keep them deriving from BaseCadastralExtensions, because the IObjectInspector needs to derive from UserControl (am I right?). So, I cannot do this with multiple inheritance :P

Is it possible to implement an IObjectInspector without trashing the class structure? Or do I need to rewrite? I wonder that composition in this matter (baseCadastralExtension to have a "funcionalities" member to take care of all the events, etc) and implement for each a custom IObjectInspector would do better?

I'm not sure if I'm being clear, but I would like suggestions from you expert ESRI devs.

share|improve this question
up vote 1 down vote accepted

I really figured this one out.

What I did was to compose the class extension with a IObjectInspector. In the init method, I would create it accordingly, like this:

My methods for object inspector just call the ones in _CustomObjectInspector

public class CustomExtension:BaseExtension,IObjectInspector
    // COM registration, etc for brevity

    protected IObjectInspector _CustomObjectInspector;

    public override Init(IClassHelper helper,IPropertySet properties)
        // init our properties
        _CustomObjectInspector = new ConcreteObjectInspector();

    #region IObjectInspector Members

    public void Clear()

    public void Copy(IRow srcRow)

    public int HWND
        get { return _CustomObjectInspector.HWND; }

    public void Inspect(IEnumRow objects, IEditor Editor)
        _CustomObjectInspector.Inspect(objects, Editor);


Thanks for the help :D

share|improve this answer
Did you consider using containment instead of inheritance? What if the classextension contained a list of sub-extensions, then when certain events fire you would loop through the list of contained sub-extensions. I've done this with editor extensions and found it to be effective. Haven't tried with classextensions though it seems like it would work there too. – Kirk Kuykendall Dec 8 '10 at 15:06
Hello Kirk, the suggestion is good. It would work! This one reached my purposes too. As the GOF says, inheritance is too restrictive, composition is always a better way! – George Dec 8 '10 at 15:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.