Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Design issues
Message
De
06/08/2010 03:05:41
 
 
À
05/08/2010 15:40:12
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:
01475497
Vues:
38
>An interface would be the simplest way to accomplish what you are looking for. All you need is the interface definition:
>
>Public Interface IParser
>    Function ParserGetContent(ByVal tnPrimaryKey As Integer) As String
>End Interface
>
>Then in your base class, add
Implements IParser
after the class definition, and change the type of oOriginator to IParser. Your existing classes would inherit the interface from the base class, and you can add the interface to any new classes that also need that method.

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)

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 ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform