java - Extending from two classes -


how can this:

public class main extends listactivity , controlmenu  

also, know approach okay have made menus in class controlmenu , extending in rest of activities.

you can extend single class. , implement interfaces many sources.

extending multiple classes not available. solution can think of not inheriting either class instead having internal variable of each class , doing more of proxy redirecting requests object object want them go to.

 public class customactivity extends activity {       private anotherclass mclass;       protected void oncreate(bundle savedinstancestate) {          super.oncreate(savedinstancestate);          mclass = new anotherclass(this);      }       //implement each method want use.      public string getinfofromotherclass()      {         return mclass.getinfofromotherclass();      }  } 

this best solution have come with. can functionality both classes , still of 1 class type.

the drawback cannot fit mold of internal class using cast.


Comments