Windows Phone variable class type -
i want create a user class type object, , maybe later change class type. eg.
there 2 custom class:
class a{} class b{}
then later want declare object changes it's type accordingly;
var obj; if(x=0) obj=new a(); else obj=new b();
is possible in windows phone visual studio environment? note: want obj global variable, can use anywhere.
it possible, not great design. should have more typesafe, either having base class , b , variable object base type or have classes interfaced.
example:
class baseclass { } class a: baseclass{} class b: baseclass{} baseclass obj;
or
interface iclass{} class : iclass{} class b: iclass{} iclass obj;
Comments
Post a Comment