質問編集履歴
1
わかりづらいと思ったので修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
class Hoge
|
6
6
|
|
7
|
-
def Hoge.self
|
7
|
+
def Hoge.whereself
|
8
8
|
|
9
9
|
self
|
10
10
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
def self
|
15
|
+
def whereself2
|
16
16
|
|
17
17
|
self
|
18
18
|
|
@@ -22,12 +22,12 @@
|
|
22
22
|
|
23
23
|
#In main
|
24
24
|
|
25
|
-
p Hoge.self #=> Hoge
|
25
|
+
p Hoge.whereself #=> Hoge
|
26
26
|
|
27
|
-
p Hoge.new.self #=>#<Hoge:0x00000002d8bc40>
|
27
|
+
p Hoge.new.whereself2 #=>#<Hoge:0x00000002d8bc40>
|
28
28
|
|
29
29
|
```
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
-
上記のソースコードにおいてHoge.self もselfも同じselfを返しているはずなのにどうして違うものが返ってくるのでしょうか?
|
33
|
+
上記のソースコードにおいてHoge.whereself もwhereself2も同じselfを返しているはずなのにどうして違うものが返ってくるのでしょうか?
|