Professional Documents
Culture Documents
4
Inheritance( 多數翻譯成”繼承” )
Car class is a parent, superclass, or base class which
has an exclaim() method.
5
Override a Method
overrode the exclaim() method. We can override any
methods, including __init__().
6
Override __init__() method
7
Add a method
8
Get Help from Your Parent with super
11
Name Mangling for Privacy
Python has a naming convention
for attributes that should notbe
visible outside of their class
definition: begin by using with
two underscores ( __ ).
12
Method Types Some data (attributes) and functions
(methods) are part of the class itself,
and some are part of the objects
that are created from that class.
13
Polymorphism Python has a loose implementation of
polymorphism; this means that it
applies the same operation to different
objects, regardless of their class.
14
Duck Typing
15
Special Methods
16
Special Methods Tables
17