How to re-use object methods [message #85788] |
Sun, 08 September 2013 10:30  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
I learned object programming late in my career and have come to appreciate its many benefits. But one thing I have not figured out is how to make the code re-usable.
I have access to a very large object widget display program. Much of the widget is for a rather specific application, but some of the buttons, say, "Contrast" could be used in other widget display programs. So when writing my own widget program, I add a "inherit largeobject" to the object definition so that it can inherit the methods of the large object widget. But I immediately got conflicts between my object definition parameters and those in the large widget display. I have to admit I did not try very hard to debug this, in part because I was hesitant for my 500 line program to be inheriting the 50,000 line largewidge object. I ended up forgetting about inheritance and just cut and pasted the the portions of the largeobject methods I needed to create methods for my own object.
I wonder if the way to make the make the code more re-useable would have been for the author of the large widget program to have made each button in the large widget program into an object, rather than a method.
Thanks, --Wayne
|
|
|