views:

16

answers:

1

I have 2 classses -

PageScreen - Which is a base class that contains a labelfield, with some text in it.

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?

+1  A: 

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.

Sagar V
Thanks ,it was Useful
Rakesh