>this.custno = 100
>this.ocomponent = NEWOBJ('custmanager','bizobj')
>this.ocomponent.printinvoice(this)
>
>Ocomponent must know that this's property is named custno, where as if I just pass the customer number, ocomponent doesn't care anything about this.
The other way round, it has to know what does the number mean. In any scenario, a procedure/method/function must know what to do with the parameter. In case of just passing a number, you must train your method to recognize that number as a customer code; if passing a This, you must have your object name their properties in a consistent manner.
And there's an easy workaround (or maybe a future habit)- if you expect you'll have the custno named differently in various objects, you may pass the default propertyname as second parameter:
this.ocomponent.printinvoice(this, "custno")
this.ocomponent.printinvoice(thisform.txtCustno, "value")
And in the CustManager class' .PrintInvoice
Lparameters loCaller, lcProperty
do case
case type("loCaller")="N"
this.custno=loCaller
case type("loCaller.custno")="N"
this.custno=loCaller.custno
case type("lcProperty")="C"
this.custno=eval("loCaller."+lcProperty)
other
=messagebox("hey, whadd'ya want?")
return
endcase
This way you can use all thre ways of passing your custno to the same object.