Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Abstract base class vs. Base class
#3
In languages like C# and Java that don't allow multiple inheritance, there are also interfaces, which are like abstract classes except they're not allowed to specify any implementation. A class can only have one base class, but can implement as many interfaces as it wants.

You should check out what the Pythonic way of doing an abstract base class is. With Python's duck typing and lack of access modifiers, I don't think it's even possible to make a class truely abstract. The best you can probably do is add documentation saying that it's abstract.

Rather than returning null, which could have who knows what effect, you should throw an exception in the base class stub method.
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)