I have 2 classses -
PageScreen - Which is a base class that contains a labelfield, with some text in it开发者_StackOverflow中文版.
TestScreen - This class extends PageScreen. Based on the focus of the elements in this screen, I need to change the value of a label in PageScreen.
How do I access the labelField variable in PageScreen from TestScreen?
If I have understood your question correctly - you could have this setup
class PageScreen{
String labelField;
public void setLabelField(String labelField){
this.labelField = labelField;
}
public String getLabelField(){
return labelField;
}
}
class TestScreen extends PageScreen{
public String getLabelField(){
return super.getLabelField();
}
}
This should work.
精彩评论