回答編集履歴
1
説明を追記。
test
CHANGED
@@ -58,21 +58,27 @@
|
|
58
58
|
|
59
59
|
```
|
60
60
|
|
61
|
-
|
61
|
+
//親にしか無いので、どちらの場合でも親のメソッドが呼ばれる
|
62
62
|
|
63
|
-
|
63
|
+
[self onlyParent]; //=> [parent] onlyParent
|
64
64
|
|
65
|
-
|
65
|
+
[super onlyParent]; //=> [parent] onlyParent
|
66
66
|
|
67
|
-
[self onlyChild]; //=> [child ] onlyChild
|
68
67
|
|
69
|
-
//[super onlyChild]; //存在しないのでエラー
|
70
68
|
|
71
|
-
|
69
|
+
//子にしか無いので、親のメソッドは呼べない
|
72
70
|
|
73
|
-
|
71
|
+
[self onlyChild]; //=> [child ] onlyChild
|
74
72
|
|
73
|
+
//[super onlyChild]; //存在しないのでエラー
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
//どちらにもあるので、それぞれのメソッドが呼ばれる
|
78
|
+
|
79
|
+
[self both]; //=> [child ] both
|
80
|
+
|
75
|
-
|
81
|
+
[super both]; //=> [parent] both
|
76
82
|
|
77
83
|
```
|
78
84
|
|