Previous Chapter | Next Chapter | Up | Next Section | Contents

Z Classes and Inheritance


When you first create a Z Class you are presented with a complex widget which allows you to specify your class's base classes. Your Z Class inherits the methods and attributes of all its base classes. If you do not specify any base classes your class will still inherit basic Zope features which are defined by the OFS.SimpleItem.Item class. This is generally what you want, and this allows instances of your class to perform normal Zope functions such as properties management. If you want your class to be able to contain other objects, like a Folder does, then you'll have to subclass "Object Manager". This will provide you with all the standard methods to support object containment. Other base classes may be available depending on what Zope extensions you have installed.

In addition to subclassing existing classes, you can also subclass other Z Classes. This is a very powerful feature. It allows you to build complex and related classes.

Another thing to notice is that you can subclass more than one base class. This is one way in which Python differs from many other object-oriented languages. When you subclass more than one class, the order of the base classes is important, because it determines the order in which classes are searched when acquiring method and attributes. To control the order of base classes when creating a Z Class move the base classes back and forth between the unselected and selected boxes until you have them in the correct order.

Previous Chapter | Next Chapter | Up | Next Section | Contents

Banner.Novgorod.Ru