Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Override Limitation.....................


Message #1 by Krishnakant Baderia <krishnabaderia@s...> on Wed, 17 Jan 2001 17:18:18 +0530

This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C0807B.6213E560

Content-Type: text/plain;

	charset="iso-8859-1"



hi,

 

Up to my knowledge ......A method can be overrided with a signature differ

even in the return type....in any Object Oriented Language.........But When

I tried to do this VB.NET Complier refused me telling .........A method

cann't be Overrided if differ in only return type. The Code is .........

 

 

Option Explicit

Option Strict on

 

Imports System

Imports System.Collections

Imports System.Collections.Bases

 

NameSpace Krishna

 Public Class KrisCollection

  public shared localHashTable as New HashTable

 

  Public Sub New()

   MyBase.New

  End Sub

 

  Public Sub Add(ByRef Item As Object,ByVal Key as String)

   localHashTable.Add(Key,Item)

  End Sub

 

  OverLoads Overridable Public Property Item(ByVal Key as String) As Object

   Get

    return localHashTable.item(Key)

   End Get

   Set

    localHashTable.item(Key)=value

   End Set

  End Property

 

  OverLoads Overridable Public Property Item(ByVal Key as Long) As Object

   Get

    return localHashTable.item(CStr(Key))

   End Get

   Set

    localHashTable.item(CSTR(Key))=value

   End Set

  End Property

 

  Public Sub Remove(ByVal Key as String)

   localHashTable.Remove(Key)

  End Sub

 

  ReadOnly Public Property Count() As Long

   Get

    return localHashTable.count

   End Get

  End Property

 

  ReadOnly Public Property Keys() as ICollection

   Get

    return localHashTable.Keys()

   End Get

  End Property

 

  ReadOnly Public Property Values as ICollection

   Get

    return localHashTable.Values()

   End Get

  End Property

 

  OverLoads Public Function Contains(ByVal Key as String) as Boolean

   return localHashTable.Contains(Key)

  End Function

 

  OverLoads Public Function Contains(ByVal Key as Long) as Boolean

   return localHashTable.Contains(Key)

  End Function

 

  Public Sub Clear()

   localHashTable.Clear()

  End Sub

 

  Public Function GetEnumerator as IDictionaryEnumerator

   return localHashTable.GetEnumerator()

  End Function

 

 End Class

 

 Public Class Tournament

  Private lName as String

 

  Public Property Name as String

   Get

    return lName

   End Get

   Set

    lName=value

   End Set

  End Property

 End Class

 

 Public Class Tournaments

  

  Inherits KrisCollection

 

  OverLoads Public Sub Add(ByRef Item As Tournament,ByVal Key as String)

   localHashTable.Add(Key,Item)

  End Sub

    

  Overrides Public Property Item(ByVal Key as String) As Tournament

   Get

    return CType(localHashTable.item(Key),Tournament)

   End Get

   Set

    localHashTable.item(Key)=value

   End Set

  End Property

 

  Overrides Public Property Item(ByVal Key as Long) As Tournament

   Get

    return CType(localHashTable.item(CStr(Key)),Tournament)

   End Get

   Set

    localHashTable.item(CSTR(Key))=value

   End Set

  End Property

 End Class 

End NameSpace



Krishna Kant Baderia 

Sr. Developer 

Solutions Infosystems Pvt. Ltd. 

www.Solutionsny.com 



Phone : (O) +xx-xx-xxxxxxx 

           (R) +xx-xx-xxxxxxx / xxxxxxx 

  








Message #2 by "Thomas Tomiczek" <t.tomiczek@t...> on Wed, 17 Jan 2001 13:57:18 +0100
You are wrong.



VERY few OO languages allow a method to be overridden if it differs only

in return type.



Thomas Tomiczek

THONA Consulting



-----Original Message-----

From: Krishnakant Baderia [mailto:krishnabaderia@s...]

Sent: Mittwoch, 17. Januar 2001 12:48

To: ASP+

Subject: [aspx] Override Limitation.....................







hi,



Up to my knowledge ......A method can be overrided with a signature

differ even in the return type....in any Object Oriented

Language.........But When I tried to do this VB.NET Complier refused me

telling .........A method cann't be Overrided if differ in only return

type. The Code is .........






  Return to Index