Basic but confirmation of override when inherited
#! /usr/local/bin/python
# -*- coding:utf-8 -*-
class Parent(object):
def show(self):
self.stdout()
def stdout(self):
print "poko"
class Child(Parent):
def stdout(self):
"""
override
"""
print "child poko"
if __name__ == "__main__":
parent = Parent()
parent.show()
child = Child()
child.show()
$ python parent_child.py
poko
child poko
Recommended Posts