|
Joe Pluta wrote: >I'm a little unclear as to how tightly typed the type O variables are. >If I declare a type O variable as class Widget, must I instatiate an >object of type Widget to stick in there? Can I use a subclass of >Widget? Can I use a class that's NOT a subclass, provided the method I >later invoke has the same signature? > >I can do this with a factory method. I'd have to instatiate the >factory, and then pass the class name into the factory as a parameter to >instantiate the actual object (or have a delegate method in the factory >that emulates the desired method, only taking a class name as well). It >would be a little easier if I could do it in the RPG, is all. Joe, maybe I'm stating the obvious here, and you've already looked into this, but if not, it might be worth a try. I believe what you need is a custom class loader. You can write them yourself if you study how Java does it. This could be a static class and loader method, so that when you called it with the class.method variable name it would not have to be instantiated each time. You might even be able to do some of this in RPG, but I'm not at all sure about that. But I have seen and heard of people writing stranger class loaders than that -)! Also, as to your last point, can't you define interfaces for the classes and methods you're interested in ant invoke them via the interface method? By doing this you should be able to slip in almost anything as long as the signature matches. _________________________________________________________________ Jeff Furgal / MIMIX User Interface Product Architect / Lakeview Technology furgalj@xxxxxxxxxxxxxxxx / 630-282-8360 LAKEVIEW TECHNOLOGY CONFIDENTIAL This e-mail may contain SECRET, PRIVILEGED AND/OR CONFIDENTIAL INFORMATION intended only for the use of the addressee. If you are not the addressee, or the person responsible for delivering it to the person addressed, you may not copy or deliver this to anyone else. If you received this e-mail in error, please immediately notify Lakeview by returning the original message to the sender via e-mail.
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.