Java/Android use one obj pointer to reference 2 class -


say need global obj pointer, this:

/** ui:fragment頁面提供 */ public static fragmentpageradapter pager=null; 

at first, pointed class

public class homepageradapter extends fragmentpageradapter{...} 

but sometime, point class following

public class mylistpageradapter extends fragmentpageradapter{...} 

is possible ?

it possible. parent class reference can hold reference child class. i.e both of following statements valid:

fragmentpageradapter pager=null; pager=new homepageradapter(); pager=new mylistpageradapter(); 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -