hausaufgabe--python 36-- Basic knowledge of Class

00--Define a Class with properties and related functions and try to create a instance 

Running Result:

001-- Class 

to reduce duplicate work, we will use class with some variable and common functions, and user can new related instance without rewrite similar codes. 

e.g. we write a class as Animal, with the properties with eyes, mouth, nose.. and functions with eating(), running(), sleeping().... related instances can be cat = Animal(), tiger = Animal(), snake = Animal()...

To create instance with class, the way is similar with call functions. So, to name a class, we start with uper letter, and use small letter for defining a function's name. 

原文地址:https://www.cnblogs.com/Shareishappy/p/7481983.html