mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-01-19 21:23:26 +08:00
Adapt code example in advanced/classes.rst to new handling of forgetting to call the superclass __init__ (#2429)
This commit is contained in:
parent
4493751a5f
commit
b3d8fec066
@ -159,7 +159,7 @@ Here is an example:
|
||||
|
||||
class Dachshund(Dog):
|
||||
def __init__(self, name):
|
||||
Dog.__init__(self) # Without this, undefined behavior may occur if the C++ portions are referenced.
|
||||
Dog.__init__(self) # Without this, a TypeError is raised.
|
||||
self.name = name
|
||||
def bark(self):
|
||||
return "yap!"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user