Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design issues
Message
From
06/08/2010 14:12:53
 
 
To
06/08/2010 10:31:53
General information
Forum:
ASP.NET
Category:
Class design
Title:
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01475236
Message ID:
01475562
Views:
34
>>I may have mis-understood Michels requirements but I don't see how an interface would help. In the scenario he gave which classes should implement IParser?
>>It would be useful if he wanted to use a class that was not based on the Parser class to implement the ParseGetContent() method - but that is not the case. He wants to override the behaviour of ParseGetContent() in an existing instance of Parser (or one of its derived classes)
>
>IAC, despite the fact that I have properly defined the interface in the base class, I was not able to get the proper syntax in the client to overrides the interface method. Basically, when I call the interface method from the base class, it executes the method from the class definition and never goes in the client interface method. It seems overrides is not supported in an interface. So, I came to the same conclusion that it wouldn't help me.
>
>>But question for Michel: If the GetPage() method knows which behaviour of ParseGetContent() should be used why not just instantiate the relevant sub-class to do the work ?
>
>I am not sure I understand this one. Can you provide additional information?

Going back to you original post and completing the derived class I assumed something like:
Public Class Parser
    Public Function ParseForTable() As Boolean
        Return ReplaceWithThisContent()
    End Function
    Public Overridable Function ReplaceWithThisContent() As Boolean
        Return True
    End Function
End Class

Public Class DerivedParser
    Inherits Parser
    Public Overrides Function ReplaceWithThisContent() As Boolean
        Return False
    End Function
End Class
If that is a valid representation then why would this not work:
Public Class ViewPagePage
    Public Function GetPage() As Boolean
        ' Just instantiate the version of Parser that suits your requirements? e.g:
        Dim loParser As DerivedParser = New DerivedParser()
        'Etc
        Return loParser.ParseForTable()
    End Function
End Class
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform