on 11-15-2013 11:25 AM
In a PB12.5 pfc-enabled application I have an object function with code as follows:
public function integer of_connect(ref transaction mytr)
mytr = create n_tr
mytr.dbms = profilestring('my.ini', 'Switches', 'DBMS', 'ODBC')
mytr.dbparm = profilestring('my.ini', 'Switches', 'Dbparm', '')
connect using mytr;
return mytr.sqlcode
This function is called from many places.
Sometimes case 1:
integer li_ret
transaction ltr
li_ret = of_connect(ltr)
Sometimes case 2:
integer li_ret
n_tr ltr
li_ret = of_connect(ltr)
Both seem to work.
Is this usage legal?
Or should I change all case 1 calls to declare ltr as 'n_tr' instead of 'transaction'
and of_connect() argument as 'n_tr'? The trouble is it is a large app and there are
maybe a thousand instances of case 1.
Could someone point me at documentation which discusses this issue or educate me in
the pros and cons of this usage?
Hi Larry;
1) As Guillaume has already correctly pointed out this your method implementation is 100% OK.
FWIW:
2) Your implementation example has nothing to do with OverLoading.
3) Your implementation example has nothing to do with Polymorphism. Of which, there are two types:
- Inclusional
- Operational
Ahhhh ... for the good old days of teaching the "BOOA" Course!
Regard ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Larry,
Both cases are legal, as pointed out by Guillaume and Chris. However, in a PFC-enabled application you should be using n_tr (or any objects inherited from n_tr).
Besides, you don't seem to be leveraging the power of PFC because you are creating your own functions (of_connect) instead of using the functionality already built on the PFC objects.
Regards,
Manuel
User | Count |
---|---|
76 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.