I have a class X where I would like to reuse methods to avoid redundant code.
Class X extends RunBase.
Now I want to make a class Y which extends RunBaseBatch but I want to use
the methods i class X.
If Y extends X, I cant use the batch functionallity.
Do anyone has a suggestion how to solve the problem ?
KBO
public class X extends RunBase
{
public void run()
{
}
}
public class Y extends RunBaseBatch
{
X x;
public static void main(Args _args)
{
Y y = new Y(_args);
;
y.run();
}
public void new(Args _args)
{
x = new X(_args);
}
public void run()
{
x.run();
}
}
--
My LinkedIn Profile:
http://www.linkedin.com/in/noebauer
Xing:
https://www.xing.com/profile/Markus_Noebauer
if you have writte class x i think there is another way.
When class x extends runbase it should also be possible to override/change
the classdeclarartion of this class so that class x extends runbasebatch.
Runbasebatch class itself extends runbase. So you should not get any
problems when doing so. And, depending on your needs, could be possible that
there is no need for another class, anymore....
But when you must handle another business need, i.e. doing some other kind
of operations, you can also write a new class Y that extends class x whithout
the problem.
Hope this helps you.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)
--
Best Regards,
Justin