John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Catégorie:
Programmation orienté objet
>>>
>>>Yes, my reply was about implementing the custom code in the instance of the class. This we do all the time in VFP and we can not do it in .NET.
>>>
>>>I agree with your comment regarding subclass and base class.
>>
>>Not really sure what you're talking about, but you can place code in the instance of the class through the use of protected virtual methods that are overridable and add the code you want in the instance.
>
>VFP analogue.
>
>Button's class with the
>
>MyCustomMethod method.
>
>In the form we put in the MyCustomMethod
>
>dodefault()
>
>do something else - relevant to this form only
>
>-----------------------------------------------
>What is .NET equivalent?
Button base class:
protected virtual void MyCustomMethod()
{
some code here....
}
in form:
protected override void MyCustomMethod()
{
form specific code here...
}
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement