Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Abstract base class vs. Base class
#1
Okay... in my python scripts for finding updated information, I want to create several classes to do it, each which must have a common interface.

For example.

Code:
class Character:
  method GetName
  method GetImage
  method GetStats

class Item:
  method GetName
  method GetImage
  method GetStats

class Mob:
  method GetName
  method GetImage
  method GetStats

In other words, I have many classes with common interfaces, but the implementation for each method is completely different. For example, the method "GetName" is going to be different for all of them since the strings for the name are in different locations in the WZ files. I want all of my classes to have the same interface to each of them so I can just focus on the implementation part and not the interface part.

This sounds like inheritance, I think. Create a base class with all of these methods, then have them return a null. Then create a derived class from the base class to implement those methods. However, I've also heard about abstract base classes. How is an abstract parent class different from a derived class's parent?
Reply


Messages In This Thread
Abstract base class vs. Base class - by Fiel - 2009-11-20, 07:02 PM
Abstract base class vs. Base class - by fawrh - 2009-11-20, 09:45 PM
Abstract base class vs. Base class - by Spaz - 2009-11-20, 11:21 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)