+
+2005-01-11 Manjula GHM <mmanjula@novell.com>
+ Added following files
+
+ *DefaultPropF.vb
+ *DefaultPropA.vb
+ *DefaultPropG.vb
+ *DefaultPropB.vb
+ *DefaultPropH.vb
+ *DefaultPropC.vb
+ *DefaultPropD.vb
+ *DefaultPropE.vb
+
+ Removed following files
+ * DefaultAttrA:
+ * DefaultAttrB:
+ * DefaultAttrC:
+ * DefaultAttrD:
+ * DefaultAttrE:
+ * DefaultAttrF:
+ * DefaultAttrG:
+
+ Above test cases are contributed by Sudharsan <vsudharsan@novell.com>
+
2005-01-10 Manjula GHM <mmanjula@novell.com>
* ScopeC.vb
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as base=new base()
+ Dim i as Integer
+ i=a(10)
+ if i<>10 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Shadows Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as derive=new derive()
+ Dim i as Integer
+ i=a(10)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Shadows ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Class derive1
+ Inherits derive
+ Public Shadows Default ReadOnly Property Item1(ByVal i as Integer)As Integer
+ Get
+ Return 3*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as derive1=new derive1()
+ Dim b as derive = a
+ Dim i, j, k as Integer
+ i=a(10)
+ j=a.Item(10)
+ k=b(10)
+ if i<>30 Then
+ Throw New Exception("Default Not Working properly in Derive1")
+ End If
+ if j<>20 Then
+ Throw New Exception("Default Not Working properly in Derive")
+ End If
+ if k<>10 Then
+ Throw New Exception("Default Not Working properly in Base")
+ End If
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+ Public Default ReadOnly Property Item(ByVal i as Integer,ByVal j as Integer)As Integer
+ Get
+ Return i+j
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Overloads Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as derive=new derive()
+ Dim i,j as Integer
+ i=a(10)
+ j=a(10,20)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ if j<>30 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 19
+REM ExpectedWarning: BC40007
+REM WarningMessage: Default property 'Item1' conflicts with default property 'Item' in the base class 'base' and so should be declared 'Shadows'.
+
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Overloads Default ReadOnly Property Item1(ByVal i as Integer)As Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as derive=new derive()
+ Dim i as Integer
+ i=a(10)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+Imports System
+
+Interface base
+ Default ReadOnly Property Item(ByVal i as Integer)As Integer
+End Interface
+
+Class derive
+ Implements base
+ Public Overloads ReadOnly Default Property Item(ByVal i as Integer)As Integer Implements base.Item
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as derive=new derive()
+ Dim i as Integer
+ i=a(10)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+Imports System
+
+Class base
+ Dim ia as integer
+ Public Default Property Item(ByVal i as Integer)As Integer
+ Get
+ Return ia
+ End Get
+ Set(ByVal j as Integer)
+ ia=j
+ End Set
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as base=new base()
+ Dim i as Integer
+ a(1)=4
+ i=a(10)
+ if i<>4 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+Class Class2
+ ' Define a local variable to store the property value.
+ Private PropertyValues(10) As Integer
+ ' Define the default property.
+ Default Public Property Prop1(ByVal Index As Integer) As integer
+ Get
+ Return PropertyValues(Index)
+ End Get
+ Set(ByVal Value As integer)
+ PropertyValues(Index) = Value
+ End Set
+ End Property
+End Class
+
+
+module M
+ sub main
+ Dim C As New Class2()
+' The first two lines of code access a property the standard way.
+ C.Prop1(0) = 10 ' Property assignment.
+ System.Console.WriteLine(C.Prop1(0)) ' Property retrieval.
+
+ ' The following two lines of code use default property syntax.
+ C(1) = 20 ' Property assignment.
+ System.Console.WriteLine(C(1)) ' Property retrieval.
+ end sub
+end module