Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Design issues
Message
De
08/08/2010 03:15:29
 
 
À
08/08/2010 02:57:08
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Titre:
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01475236
Message ID:
01475637
Vues:
17
>>So if I understand correctly we're back to my original suggestion. e.g in VB:
Public Class Parser
>>    Public Delegate Function RWTCDelegate() As Boolean
>>    Public Handler As RWTCDelegate
>>
>>    Public Function ParseForTable() As Boolean
>>        Return ReplaceWithThisContent()
>>    End Function
>>    Public Overridable Function ReplaceWithThisContent() As Boolean
>>        If Not Handler Is Nothing Then
>>            Return Handler()
>>        Else
>>            Return True
>>        End If
>>    End Function
>>End Class
>>
>>
>>Public Class ClassThatOverridesAParserMethod
>>    Public Function GetPage() As Boolean
>>        Dim loParser As Parser = New Parser()
>>        loParser.Handler = AddressOf RWTCOverride
>>        Return loParser.ParseForTable()
>>    End Function
>>
>>    Function RWTCOverride() As Boolean
>>        Return False
>>    End Function
>>End Class
but I still don't know why you don't just instantiate a derived Parser class that has the required method behaviour.....
>
>This works in the way that I can now put some code in this method at the client level and the code in it will be executed. However, public properties of the base class cannot be exposed in a handler method. So, I do not know how to work around that.

If you mean that you need to access other properties/methods of the Parser class from the RWTCOverride method then ?:
Public Class ClassThatOverridesAParserMethod
    Dim loParser As Parser
    Public Function GetPage() As Boolean
        loParser = New Parser()
        loParser.Handler = AddressOf RWTCOverride
        Return loParser.ParseForTable()
    End Function

    Function RWTCOverride() As Boolean
        'Access the Parser e.g:
        Dim s As String = loParser.SomeItem
        Return False
    End Function
End Class
>
>As for the derived Parser class approach, I have no idea how I can have an overridable method to be executed in a client class if the Parser class is initiated as an object. I tried that but didn't find a way to achieve that.

I think we're at cross purposes here. I don't understand why, given a Parser object with the correct behaviour, you need any override code in the class that uses it.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform