Unimatrix_001
asked on
Some sort of interface method needed?
Hi all,
I've got a normal class that does a couple of things, nothing fancy. I want an interface method, so that:
///A.java
B mb=new B();
///B.java
//When something happens in this class, call an interface method (Z for instance) in this class.
However, when the method Z in B.java is called, I want the exact same method to be called in A.java. It seems like I need some interface method, where you can't create an instance of class B unless the class creating the instance (A) has this interface method (Z) in it... Anybody any ideas on how I can do this?
Thanks,
Uni
I've got a normal class that does a couple of things, nothing fancy. I want an interface method, so that:
///A.java
B mb=new B();
///B.java
//When something happens in this class, call an interface method (Z for instance) in this class.
However, when the method Z in B.java is called, I want the exact same method to be called in A.java. It seems like I need some interface method, where you can't create an instance of class B unless the class creating the instance (A) has this interface method (Z) in it... Anybody any ideas on how I can do this?
Thanks,
Uni
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Agreed, it does go against the grain so to speak of OO design, but that is what I need... thank you both. :-)
But still, the above logic will work if needed (in those rare cases).