__author__ = "Alex Li"
import os
# os.system()
# os.mkdir()
# class Dog(object):
# def __init__(self,name):
# self.name = name
#
# # 实际上跟类没什么关系了,不传递self调用,是普通的函数,不是类方法
# def eat(self):
# print("%s is eating %s" %('self.name','dd'))
#
# def talk(self):
# print("%s is talking"% self.name)
#
#
# d = Dog("ChenRonghua")
# d.eat()
# d.talk()
class Dog(object):
def __init__(self,name):
self.name = name
# 实际上跟类没什么关系了,不传递self调用,是普通的函数,不是类方法
@staticmethod
def eat(self):
print("%s is eating %s" %('self.name','dd'))
def talk(self):
print("%s is talking"% self.name)
d = Dog("ChenRonghua")
#将实例地址传入函数,是普通的函数d.eat()报错
d.eat(d)
d.talk()