mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
add 'class' example
This commit is contained in:
parent
8b20185919
commit
754e662b39
25
examples/class/main.py
Normal file
25
examples/class/main.py
Normal 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()
|
Loading…
x
Reference in New Issue
Block a user