我试图创建一个动态继承另一个类属性的域类构造函数。但我无法让它正常工作。
这是一个例子:
class Example1 {
String name;
String location;
}
class Example2 extends Example1 {
String status;
public Example2 (Example1 orig){
// Code here to set this.name and this.location to name and location from orig
// dynamically, so adding a field in Example1 does not require me to add that
// field here.
}
}