|
Booth wrote: >Would an example of this, in RPG, be an... say... L-type date >field? Should I for example have the ability to extend the >L-date field's function so that I could have a predefined and >edited mm/dd/yy field for a display field? Would that be an >example of the OO concept of which you speak? Hmmm, sort of, I think. But I think your example is mixing a couple of different concepts here. In your example, you have a date field and an edited date field displayed on the screen. As I mentioned in my note to David, you need to distinguish between "IsA" and "HasA" relationships between your objects. (Even before that, you need to identify your objects!) If one object is some specific instance of another, that's an "IsA" relationship and inheritance is used to model the relationship. But if an object is a component or attribute of another, that's a "HasA" relationship. For example, a dog IS a type of animal and a dog HAS four legs. Implemented in an OO language, class Dog would extend class Animal and contain references to the legs. In this case, what is the relationship between a widget that displays a date and the date field? IS a date widget a date? Or does it HAVE a date? In this specific case, normally a date widget class would be an extension of another widget class, possibly a TextField in Java. A date widget object might contain a reference to a date field which could be updated automatically if the user changes that value in the widget. An example of inheritance would be if you wanted to have a date field that could only hold a specific subset of date values, say dates that represented the first working day of the month. Let's say class Date had a method called setDate. You could define a new class called DueDate that extends Date such that method setDate would be overridden to accept only the desired dates. The original class may have say a dozen different methods. The extended class might only define the one method that's different. All other methods would be inherited by the sub-class. As I said in my previous note, experience with OO design and implementation is an excellent teacher. Cheers! Hans Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-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-2025 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.