小编Mol*_*lly的帖子

从父级创建子对象的最佳方法

在给父母提供数据的情况下,创建孩子的最佳方法是哪种?是否可以在子类上使用包含所有父值的方法:

public class Child extends Person {
  public Child(Parent p) {
    this.setParentField1(p.getParentField1());
    this.setParentField2(p.getParentField2());
    this.setParentField3(p.getParentField3());
    // other parent fields.
  }
}
Run Code Online (Sandbox Code Playgroud)

复制父数据ti子对象?

Child child = new Child(p);
Run Code Online (Sandbox Code Playgroud)

java inheritance downcast

7
推荐指数
1
解决办法
1万
查看次数

Android 2.3和Phonegap,navigator.online不起作用

我测试了navigator.online,直到我用PhoneGap构建了应用程序,之后,navigator.online总是返回true.有谁知道如何取消缓存或刷新此值?我需要"点击"活动.

html5 android cordova

2
推荐指数
1
解决办法
2532
查看次数

标签 统计

android ×1

cordova ×1

downcast ×1

html5 ×1

inheritance ×1

java ×1