Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Abstract classes useful?
Message
De
04/06/2008 09:14:21
 
 
À
04/06/2008 08:35:26
Thomas Ganss (En ligne)
Main Trend
Frankfurt, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01320973
Message ID:
01321561
Vues:
13
>>Dont base an object on this class is really what
>
IF isabstract(This,This.class)
>   debugout "instanciation of abstract class "+This.class
>   error "instanciation of abstract class "+This.class+" is not allowed"
>   Return .F.
>endif
>
>>is about. Whatever that isabstract() function would check.
>
>Yupp, when "instance subclassing" you'd need to overwrite that method, as the aforementioned check on left(this.class, 1)="_" would still fail, as the parentclass is still the abstract one. From that POV you can argue that it is not "really" a abstract class since overwriting the mangled methods makes it concrete.

Or you define instance subclassing as not valid enough to make a concrete class of an abstract one. So you'd burden yourself to make one more subclass before using it on a form.

Be aware that the value of this.class is always the class that is instanciated, even if the code checking this.class is inherited, it's not checking This::class, it's checking this.class. So subclassing "abstract_" with that code in init as "concrete" you don't need to overloading that init, the concrete class will instanciate. I think if you want abstract classes to behave as they should, eg fail to instanciate, it's better to have such behaviour than nothing, even if it might not work in every situation.

Bye, Olaf.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform