OO-construction... does it exist?

Den Duze

Member
Hi,

I have the need for some methods that are (almost) always the same and I wonder if there exists some OO-contruction that makes this easier.

example I always have 4 possible methods for every check that I want to make)
Code:
  method public static character mHasDocuments( p-hBuffer as handle):
    return serverbl:mHasDocuments( p-hBuffer
                                    , p-hbuffer:table
                                    , false
                                    ).
  end method.

  method public static character mHasDocuments( p-hBuffer as handle, p-NMtable as character):
    return serverbl:mHasDocuments( p-hBuffer
                                    , p-NMtable
                                    , false
                                    ).
  end method.

  method public static character mHasDocuments( p-hBuffer as handle, p-YNvaluesAvailableInBuffer as logical):
    return serverbl:mHasDocuments( p-hBuffer
                                    , p-hbuffer:table
                                    , p-YNvaluesAvailableInBuffer
                                    ).
  end method.

  method private static character mHasDocuments( p-hBuffer as handle, p-NMtable as character, p-YNvaluesAvailableInBuffer as logical):
    <THIS IS THE REAL CODE TO GET THE INFORMATION>
  end method.

But I need to have the same construction for mHasImages, mHasNotifications, mHasPictures, ....
I can always make the same 4 methods, change the methodnames and change the code in the private method.
But because the first 3 methods are always the same construction (except for the method-name) I wonder if there is some kind of OO-construction so that I only need to put the last method (so the one with specific code) in my class.

Or is this a bad way of working?

Regards
 
Top