[Tutor] Classes

VanL vlindberg@verio.net
Tue, 03 Apr 2001 18:52:28 -0600


Here is my second question:

I am investigating python's inheritance structure.  Given the class
LinkedList:

class LinkedList:
    
    """ This class provides a generic node for linked lists.  Other
python classes or
    objects can inherit from this class to get the ability to represent
themselves as
    a linked list. """

    def __init__(self, name, object=None):
        self.__label = name
        if object: self.__link = object
        else: self.__link = None

[snip to end]


and the class NewClass:

class NewClass(LinkedList):
	
	def __init__(self):
		NewString = "This is a new string"

	def NewString(self):
		print NewString


How do I supply the superclass constructor arguments when instancing an
object of type newclass?  How does this change if I inherit from
multiple classes?

Thanks,

Van