# -*- encoding: utf-8 -*-
import datetime
class Person:
def __init__(self,name,age,gender):
self.name,self.age,self.gender=name,age,gender
def bd(self):
bdate=datetime.datetime.now().year-self.age
print(self.name,"出生于",bdate)
class Gov(Person):
def __init__(self,name,age,gender,title):
Person.__init__(self,name,age,gender) # self 要写上,要么super().__init__(name,age,gender)
self.title=title
def flatter(self):
self.bd()
print("就成为了",self.title,"真棒")
p1=Gov("david",32,"male","president")
print(p1.age)
p1.flatter()