Fun with PRIVATE

Although it’s common knowledge that Clarion class methods have an implicit (SELF) object as the first parameter, it hadn’t occurred to me to try something like the attached program before. Look in the constructor in PrivateClass.clw. If you want really private methods, this seems like it could be a good way to keep them from being exposed. (2.3 KB)

A downside is that code completion doesn’t work with “methods” declared this way.

I’m on my phone can you please
Paste the actual code here vs attaching a zip

My guess is you wrote an extension method

   PrivateMethod(MyPrivateClass pMP,LONG pIn,LONG pOut),LONG

MyPrivateClass.Construct PROCEDURE

  SELF.Result =  SELF.PrivateMethod(12,40) !Notice that the SELF works here.

PrivateMethod  Procedure(MyPrivateClass pMP,LONG pIn,LONG pOut)!,LONG


  Return pIn ^ pOUt

Yes that’s a what I meant by an extension method

Thanks Mark. I guess there’s a name for everything! :slight_smile:

Extension methods are a formalized thing in…net