class chello:
def show(self):
return "hello world class!"
a = chello();
print a.show();
or
class chello:
@property
def show(self):
return "hello world class!"
a = chello()
print a.show
or
#!/usr/bin/python
class chello:
def show(self):
return "hello world class!"
x = chello();
print x.show();
or
class chello:
@classmethod
def show(self):
return "hello class world123!"
a = chello()
print a.show()
沒有留言:
張貼留言