java - Redirect interface method calls -
i have interface1
, 2 implementations of it, classa
, classb
. want redirect method calls classa classb. i'm doing this:
class classa implements interface1{ method1(){ b.method1(); } method2(){ b.method2(); } method3(){ b.method3(); } //and on... }
is there more easy way this?
have considered using abstract class instead of interface? can put common implementations in abstract class, , in classa
, classb
implement methods 2 classes differ.
abstract class abstract { void method1() { //do stuff... } abstract void method2(); } class classa extends abstract { @override void method2() { // something... } } class classb extends abstract { @override void method2() { // else... } }
Comments
Post a Comment