Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
If inheritance is a prime reason for OOP, then why...
Message
 
 
À
31/12/1998 01:07:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00171748
Message ID:
00171941
Vues:
30
Jim,

>I do not think its very intuitive. If an object inherits, it ought to inherit all of the superclass functionality without the programmer having to do anything to ensure that happens -- but...

The way it is in VFP and C++, although a pain to code and sometimes forgotten, is much more controlled because the inherited code can be called at the beginning, middle or end of the overridden code. Which in some cases is very desireable to have this flexibility. I'd say on the average I call the inherited code at the top 85% of the time, in the 5% and the bottom 10%.

>now having said that, I have to admit that the VFP approach is a lot more flexible. I increasing like the idea that parent code can be avoided where it is not needed -- and the more I use it, the more I like it.

If you find yourself not calling the ParentClass code from an overridden method it may point to a design problem of the class.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform