"KraftDiner" <[EMAIL PROTECTED]> writes: > I have a base class called Shape > And then classes like Circle, Square, Triangle etc, that inherit from > Shape: > > My quesiton is can a method of the Shape class call a method in Circle, > or Square etc...?
Yup: >>> class Shape(object): ... def commented_draw(self): ... print "Drawing", self.__class__.__name__ ... self.draw() ... >>> class Circle(Shape): ... def draw(self): ... print "Drawing a Circle" ... >>> c = Circle() >>> c.commented_draw() Drawing Circle Drawing a Circle >>> Or maybe you meant invoking them directly, which a method in Shape would do by calling Circle.draw(self). The latter is ugly - you should use self.draw() to invoke the draw routine that's correct for self. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list