Created
July 2, 2012 15:48
-
-
Save bonprosoft/3033895 to your computer and use it in GitHub Desktop.
言葉遊び的な何か
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Strict On | |
Module Module1 | |
Sub Main() | |
Dim TestClass As New TestClass | |
'<Output> Test.TestClass ->クラスが読み込まれた(同じ階層の変数名を発見して処理が終わった) | |
Console.WriteLine(TestClass.ToString) | |
'<Output> Function.TestClass ->関数が読み込まれた(1つ階層が上がったところで処理が終わった) | |
Console.WriteLine(TestClass2.ToString) | |
'エラー ((この例はNewしていないので、本当はダメだけど...! | |
'Console.WriteLine(TestClass2.hoge()) | |
'クラスの中のクラスの処理について実験してみます | |
Dim c As New TestClass | |
c.Start() | |
Console.ReadLine() | |
End Sub | |
Function TestClass() As String | |
Return "Function:TestClass" | |
End Function | |
Function TestClass2() As String | |
Return "Function:TestClass2" | |
End Function | |
End Module | |
Public Class TestClass | |
Public Function Sample() As String | |
Return "TestClass::Sample" | |
End Function | |
Public Sub Start() | |
Dim cls1 As New TestClass | |
'<Output> TestClass.TestClass::Sample ->同じ階層にアイテム(クラス)がある場合は下に降りていく! | |
Console.WriteLine(cls1.Sample()) | |
'<Output> TestClass::Sample ->上に上に行って、初めてTestという名前が出た階層から、下に降りていく! | |
Dim cls2 As New Test.TestClass | |
Console.WriteLine(cls2.Sample()) | |
End Sub | |
Public Class TestClass | |
Public Function Sample() As String | |
Return "TestClass.TestClass::Sample" | |
End Function | |
End Class | |
End Class | |
Public Class TestClass2 | |
Public Function hoge() As String | |
Return "TestClass2.hoge" | |
End Function | |
End Class | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment