2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / mbas / Test / tests / OverrideE.vb
1 'Author:
2 '   V. Sudharsan (vsudharsan@novell.com)
3 '
4 ' (C) 2005 Novell, Inc.
5
6 'Checks if Default is working or not with Overrides...It works
7
8 Imports System
9
10 Class base
11         Public Default Overridable ReadOnly Property Item(ByVal i as Integer)As Integer
12                 Get                     
13                         Return i
14                 End Get
15         End Property
16 End Class
17
18 Class derive
19         Inherits base
20         Public Default Overrides ReadOnly Property Item(ByVal i as Integer)As Integer
21                 Get                     
22                         Return 2*i
23                 End Get
24         End Property
25 End Class
26
27 Module DefaultA
28         Sub Main()
29                 Dim a as derive=new derive()
30                 Dim i as Integer        
31                 i=a(10)
32                 if i<>20 Then
33                         Throw New Exception("Default Not Working")
34                 End If
35         End Sub
36 End Module