Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Abstract classes useful?
Message
From
04/06/2008 06:46:08
 
 
To
04/06/2008 04:14:39
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:
01321526
Views:
13
>For me "abstract class" is merely a definition/description of usage: don't base an object on this class. In different languages there is more or less need for such consturcts: I see abstract classes really close to the definition of interfaces<g>.

Close, yes.

To be picky, the wikipedia article about template methods has a java example of an abstract game class (http://en.wikipedia.org/wiki/Template_method), which has abstract empty methods and one template method. Interfaces are mainly about seperation of definition and implementation. So an interface is more likely a special case of an abstract class then the other way around.

Abstract classes can contain code and perhaps also should do so. On the way from Game to Chess you might have several class levels in between that implement common code you can use for several chess variants. They're just no concrete games already.

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.

Bye, Olaf.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform