From: D-Man <ds...@ri...> - 2001-04-04 14:31:18
|
( I don't mean to be condescending at all, but I want to make sure this doesn't cause some confusion. ) An object can't be abstract, only classes can. Objects also can't be subclassed, only classes can be subclassed. Also, 'self' hasn't been "called", it was only used to access an attribute. (calling it would look like self() or self( <some arguments here> ) and would require defining the function __call_ ) I think Brian knows this, but mixed a couple of terms around in writing this. Other than the wording issues, everything Brian said is accurate and (hopefully) helpful to you. -D On Tue, Apr 03, 2001 at 03:05:05PM -0500, Brian Zimmer wrote: | | Wayne, | | You can call "self" on an abstract object, you just can't instantiate | an abstract object. An abstract object has all the state and | behaviour of a normal, concrete object it just can't live on it's | own. It needs to be subclassed and made abstract. For a good example | of this, check out the java.io.* packages, in particular, either the | Reader/Writer or InputStream/OutputStream classes and their | subclasses. Look at FileReader and you'll notice it is an | implementation of the abstract Reader class, all FileReader provides | to Reader is how to get the initial data, in this case a File. | | Python really doesn't have the notion of an abstract class, in general | an abstract class or interface is implemented by defining a bunch of | methods which raise Exceptions. | | So in your case, you can't instantiate a Component, but you can get | subclasses of Component and then call methods on them. | | hope this helps, | | brian |