类和对象: 我们经常会对打印一个对象来得到对象的某些信息. class pair: def __init__(self,x,y): self.x=x self.y=y if __name__=='__main__': p=pair(3,4) print p E:\python2.7.11\python.exe E:/py_prj/python_cookbook/chapter8.py <__main__.pair instance at 0…
<?php interface ICanEat{ public function eat($food);} class Human implements ICaneat{ public function eat($food){ echo "Human eating".$food."\n"; } } class Animal implements ICaneat{ public function eat($food){ echo "Animal eat…