|
I may be showing my ignorance, but why would you want to have two entirely different subprocedures with the same name? It seems like it would be very confusing to me. Albert York -----Original Message----- From: Bartell, Aaron L. (TC) [SMTP:ALBartell@taylorcorp.com] Sent: Tuesday, May 08, 2001 2:40 PM To: 'RPG400-L@midrange.com' Subject: RE: Overloading in RPG. Agreed. I have this new thirst since I have started coding in Java. Java definitely has some cool features that I think are within the reach of RPG. Will the RPG group ever look at overloading? Hans? Aaron Bartell -----Original Message----- From: Jim Langston [mailto:jimlangston@conexfreight.com] Sent: Tuesday, May 08, 2001 3:56 PM To: RPG400-L@midrange.com Subject: Re: Overloading in RPG. Overloading is purely an OOPS thing, and you could do the same thing with *OMIT or *OPTION in RPG, although not exactly the same. Regards, Jim Langston Me transmitte sursum, Caledoni! "Bartell, Aaron L. (TC)" wrote: > > I am wondering if anyone knows if "overloading" is in RPGILE's future. I am > talking about overloading similar to what Java has. I just found another > application where this would prove most valuable. > > For those who don't know what overloading is it basically allows you the > programmer to have multiple methods(subprocedures) with the same name but > they accept different parm structures. So in your RPG programs based on the > parameter types you pass it will decide which method(subprocedure) will > actual be called. > > here is an example: > > I could call #getDate with two or three parms. . . > > C callp #getDate(parm1:parm2) > C callp #getDate(parm1:parm2:parm3) > > and based on the data type of each parm and how many are passed it knows > which sub procedure to call. You could have two #getDate sub procedures > that both receive two parms but have different data types for parm1 and > parm2. > > Here is what #getDate would look like. > > *//////////////////////////////////////////////////////////////* > * (#getDate) Get Date * > *//////////////////////////////////////////////////////////////* > P #getDate B EXPORT > *--------------------------------------------------------------* > D #getDate PI * > D parm1 4 > D parm2 4 > > *--------------------------------------------------------------* > C //put calcs in here > > C return ?? > *--------------------------------------------------------------* > P #getDate E > > ...or... > > *//////////////////////////////////////////////////////////////* > * (#getDate) Get Date * > *//////////////////////////////////////////////////////////////* > P #getDate B EXPORT > *--------------------------------------------------------------* > D #getDate PI * > D parm1 4 > D parm2 4 > D parm3 9 0 > *--------------------------------------------------------------* > C //put calcs in here > > C return ?? > *--------------------------------------------------------------* > P #getDate E > > Aaron Bartell > +--- > | This is the RPG/400 Mailing List! > | To submit a new message, send your mail to RPG400-L@midrange.com. > | To subscribe to this list send email to RPG400-L-SUB@midrange.com. > | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: david@midrange.com > +--- -- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.