Ignore:
Timestamp:
Mar 22, 2008, 2:00:18 AM (17 years ago)
Author:
dai
Message:

・デリゲートの共変戻り値、反変引数に対応した。
・core.libで定義されたデリゲートがアプリケーションプロジェクトで利用できないバグを修正。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/TestCase/SimpleTestCase/DelegateTest.ab

    r356 r491  
    11Namespace DelegateTest
     2
     3Class StringEx
     4    Inherits String
     5Public
     6    Sub StringEx( str As String )
     7        String( str )
     8    End Sub
     9End Class
    210
    311Delegate Sub Callback1()
    412Delegate Function Callback2() As Long
    513Delegate Sub Callback3( a As Long )
    6 Delegate Sub Callback4( a As String )
     14Delegate Sub Callback4( a As StringEx )
    715Delegate Function Callback7( str As String ) As String
    8 
    916
    1017Class TestClass
     
    6168    End Sub
    6269
    63     Static Function Proc7( str As String ) As String
    64         Return "Proc7 result[" + str + "]"
     70    Static Function Proc7( str As String ) As StringEx
     71        Return New StringEx( "Proc7 result[" + str + "]" )
    6572    End Function
    6673
     
    8491    dg2()
    8592    dg3( 100 )
    86     dg4( "Proc4 calling" )
     93    dg4( New StringEx( "Proc4 calling" ) )  ' 反変引数サポートのテスト
    8794
    8895    UnitTest( "Delegate1", testObj.CheckFlags() )
    8996
    90     Dim dg7 = New Callback7( AddressOf(TestClass.Proc7) )
     97    Dim dg7 = New Callback7( AddressOf(TestClass.Proc7) )   ' 共変戻り値サポートのテスト
    9198    UnitTest( "Delegate2", dg7( "test value" ) = "Proc7 result[test value]" )
    9299
Note: See TracChangeset for help on using the changeset viewer.