[Xotcl] Abstract class

Kristoffer Lawson setok at scred.com
Fri Apr 4 15:26:17 CEST 2008


On 1 Apr 2008, at 23:35, Victor Mayevski wrote:
> Can somebody please update the XOTcl tutorial/reference to explain in
> detail what abstract class is and how to use it (examples of usage)?
> I've been looking everywhere and can't find the info.

I'm not a core XOTcl developer, but the general case for abstract  
classes is that you want to have a superclass for a variety of other  
classes and this superclass provides some of the methods, but not  
all. The rest, or a small subset, can be specified as 'abstract'  
methods. With these only the 'style' of the method is described --  
what arguments it takes, what it is named, perhaps what it returns  
and what it does. The sub-classes are then required to do the actual  
implementation of these methods.

So say you have a general 'GraphOb' class. It has an abstract method  
'draw'. It cannot draw itself, or anything else, but it expects the  
sub-classes to implement this  method. You might then have  
'Rectangle' and 'Circle' which are subclasses of GraphOb and each of  
these have a 'draw' method which draws the rectangle or circle on to  
the screen.

Some classes might only have abstract methods...

Hope this explains it a bit.

            / http://www.scred.com/
            / http://www.fishpool.com/~setok/




More information about the Xotcl mailing list