質問編集履歴
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,10 +1,38 @@
|
|
1
1
|
###前提・実現したいこと
|
2
2
|
|
3
|
-
|
3
|
+
Javaで抽象クラスの変数を格納した新たなインスタンスをコピーして返却する方法を模索しています。
|
4
4
|
|
5
|
-
|
5
|
+
イメージは以下のような形です。
|
6
6
|
|
7
|
+
|
8
|
+
|
9
|
+
abstract class TestClass {
|
10
|
+
|
11
|
+
protected String str;
|
12
|
+
|
13
|
+
protected int num;
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
public Object copy {
|
18
|
+
|
7
|
-
|
19
|
+
TestClass testClass = null;
|
20
|
+
|
21
|
+
...
|
22
|
+
|
23
|
+
...
|
24
|
+
|
25
|
+
return testClass;
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
}
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
抽象クラスはインスタンスを作れないですが、
|
34
|
+
|
35
|
+
何か値を渡す手段はないでしょうか。
|
8
36
|
|
9
37
|
|
10
38
|
|
1
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|