Friday 15 August 2014

java - Can I automatically add classes that implement my interface to a list? -


I have created an interface that I found in many sections. I will add the interface to the number of classes that are often implemented, and therefore I would like to reduce the initial work of doing this.

What am I trying to do:

To automatically add a category that applies my interface to the list (only in the interface?)

I'm not sure if this is possible, can someone tell me in the right direction?

Thank you.

It seems that you are looking to create a parent class that implements your interface , And after that there are many children's classes that automatically access the classes of children from all classes of parent classes from the inherit original class, and they also apply the interface.

Think something like this:

  interface myInterface {// interface methods here ...} class parentClass implements myInterface {// all // interface methods Provide Normal Implementation} class childClass1 provides parentClass {// Provide an override of any method that you want // here, or new methods have not been defined, which is described above) Class class class increases the Patrick class {// aa If you can create more than one child class then class childclass3 increases the parent class {// you can create more than one child class}  

Now, childClass1, childclass2, and childclass3 all Apply my information, and they are applicable for all methods that are defined in parentClass.


No comments:

Post a Comment