Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Abstract classes useful?
Message
From
04/06/2008 09:14:21
 
 
To
04/06/2008 08:35:26
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01320973
Message ID:
01321561
Views:
12
>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform