Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I have a true BASE class for everything?
Message
 
 
À
27/01/2009 03:01:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01375878
Message ID:
01377275
Vues:
12
>>>>In VFP, how can I have a structure of my classes wherein I have one ground-zero class from which all other classes, even of different baseclass type, will inherit from?
>>>>
>>>>For instance, say I want a method or property to be present in all my classes; every textboxes, every checkbox, every label, containers, etc.
>>>>
>>>>Since each class can only be based on a class of the same type, I have no real ground-zero point at which I can add stuff that will be inherited by all my classes. So, apparently, I have to add the property or method to each of my root base classes. Add the new property to my textbox baseclass, add the new property to my checkbox baseclass, add the new property to my label base class, blah, blah, blah. Maintaining them in this manner seems to be a little short of a full OO architecture.
>>>>
>>>>From what little I have learned about C# classes, I think you can indeed have a one ground-zero object class on which even different class types can be based.
>>>
>>>I thought I have some C# knowledge:) How can you do it in C#? IMHO you can't. I haven't seen such a thing even in C# 4.0. What am I missing?
>>>
>>>PS: If you mean Object you can downcast to it but can you modify it (Object class) in any way?
>>>
>>
>>That's a valid point. Even though .NET has a ground-zero Object class from which all other classes inherit, you can't modify it.
>
>But using extension methods can make it look/behave that way,

Thanks. I have not gotten to those yet -- still working on mastering the basics -- but will make a note to do so.

Yesterday I learned about .NET ErrorProvider controls. Very cool! I think they are a much cleaner, less intrusive approach than forcing the user to deal with MessageBoxes.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform