BasePage.java
public class BasePage {
//do stuff
}
中心.java
public class Center {
public BasePage click(){
click(button);
return new BasePage(this);
}
// do other stuff
}
public class Helper {
protected Center center;
// do stuff
}
页面.java
public class Page extends BasePage {
//do stuff
}
测试类.java
public class TestClass extends Helper {
private Page page;
// I can use "center.click()" because TestClass extends from Helper,
// and "center" is a protected variable in Helper
// "center.click()" returns type 'BasePage'
// 'page' is a type 'Page' which extends 'BasePage'
// So why can't I put the result of "center.click()" into 'page' ?
page = center.click();
}