gpt4 book ai didi

Java 扩展类

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:30:10 25 4
gpt4 key购买 nike

<分区>

基本页面.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();

}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com