On Fri, 20 Feb 2009, Enrico Maria Giordano wrote:

Hi,

>> You can subclass the GET() class and create your custom setPosMy() method,
>> or maybe you can even override the original and continue to use the name.
> Can I add my own method to a class without touching the class itself? If 
> yes, how?

Harbour has a feature which can block class modification so such
action can be forbidden by programmer.
Anyhow if class is not locked (core classes isn't) then it's possible.
But you have to be careful because it's possible to create some really
strange results, f.e. when you add some new methods to the class from
which some other classes inherited before and then in object of this
classes you will use super casting.
   __clsAddMsg( <hClass>, <cMessage>, <sMthFunction> | <bMthBlock>, <nType>, ;
                [xInit], <uiScope> )
f.e.:
   __clsAddMsg( getNew():hClass, "MYMSG", @myMethod(), HB_OO_MSG_METHOD,, ;
                HB_OO_CLSTP_EXPORTED )

best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to