Private overridable? - Forum - OpenEdge Development - Progress Community

Private overridable?

This question is answered


There is a way to make a protected method callable from a derived class but overridable by making it FINAL.

Is there a way to do the opposite?

I.e. make a method overridable, but not callable by a derived class.

An example could be a protected abstract method that only the base class should call in a specific order or scenario.

The derived class is allowed or obliged to provide an implementation, but should never directly call the method.

It seems something like this is possible in c++ using "private virtual".

I was wondering if any construct in ABL could mimic this...

See and

Verified Answer
  • Sure, I gave the original problem another thought and in this case think I found a cleaner solution.

    Nevertheless, I thought it was worth starting a discussion...

    One other solution we thought off (but became redundant because of the refactoring) was to move the implementation of the method to another class (strategy pattern), and have that injected into the base class (composition!).

All Replies
  • A single method interface that does not enforce the method name – just the signature.
    It’s made for callbacks and it is the foundation for events (not only in .NET).
    And – I’d love to see them in the ABL one day for ABL classes as well as support for ABL methods to implement .NET delegates (to avoid the need for the workaround that Marian described).
    But it’s not on top of my OO wish list 😊 But not doing to hijack Jeffs thread with that.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • Not that important, but delegates are not OO according to others. You find them in functional languages and multi-paradigm languages. "One example is C#, which includes imperative and object-oriented paradigms, together with a certain level of support for functional programming with features like delegates (allowing functions to be treated as first-order objects)"

      Not wanting to hijack anything and going off-topic ;-) but 

    "Probably you will be surprised how similar functional and OO code is, and that most ideas are things you already know."