mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00: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):
|
class Dachshund(Dog):
|
||||||
def __init__(self, name):
|
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
|
self.name = name
|
||||||
def bark(self):
|
def bark(self):
|
||||||
return "yap!"
|
return "yap!"
|
||||||
|
Loading…
Reference in New Issue
Block a user