Review:
Inheritance: Is the relationship between classes and classes, and what is a relationship of what
The purpose of inheritance is to solve code reuse problems and reduce code redundancy
Inheritance is to inherit the attributes of the parent class to the subclass.
Derivation is a subclass that derives its own new property
classteacher:def __init__ (self,name,age,sex,salary,level): Self.name=name Self.age=Age Self.sex=Sex self.salary=Salary Self.level=Level def walk (self): print ('%s is walking'%self.name) def teach (self): print ('%s is teaching'%self.name) def tell_info (self): print (" "----------%s Info--------NAME:%s Age:%s SEX:%s SAL:%s Level:%s" "% (self.name,self.name,self.age,self.sex,self.salary,self.level))# #classdate:def __init__ (self,year,mon,day): Self.year=Year Self.mon=Mon self.day=Day def Tell_birth (self): print ('%s-%s-%s'% (Self.year,self.mon,self.day))
Combination of applications:
Further optimization:
Serialization:
Deserialization:
deserialization must be based on the class in memory
Bin folder generally put executable file, conf folder generally put configuration file, DB folder general method data file, and log directory, lib directory (usually store common gadgets)
The main function provides a menu where the user can choose to work today: teachers, students, courses three classes to implement the course selection system
python--Object-oriented programming for multi-inheritance, combinatorial applications, development of software specifications