add 'class' example

This commit is contained in:
lyon 2022-03-02 23:06:00 +08:00
parent 8b20185919
commit 754e662b39

25
examples/class/main.py Normal file
View File

@ -0,0 +1,25 @@
# need core > v1.4.0
import PikaStdLib
class people:
def do_hi(self):
print('hello i am people')
def hi(self):
self.do_hi(self)
class student(people):
def do_hi(self):
print('hello i am student')
class mymem(PikaStdLib.MemChecker):
def mymax(self):
print('mem used max: ' + str(self.getMax()) + ' kB')
p = people()
s = student()
p.hi()
s.hi()
mem = mymem()
mem.mymax()