#Create ClassclassMyClass (object): Name="Donghuang too one"; Age=416466856; Shen="true God"; defUse (self):Print("This is a primitive novel of the Demon God ={}". Format (self.name)) Item=MyClass ();Print(item.name) item.name="Taisu";Print(Item.name)Print(Item.use ())classMyTest (object):def __init__(self,name="Taiyi", age=0,shen=""): Self.name=name; Self. Age=Age ; Self.shen=Shen; defUse (self):Print("This is a primitive novel of the Demon God ={}". Format (self.name)) test=myTest ();Print(test.name) test1=mytest (name="Beijing", age=600,shen="Didou");Print(Test1.name)#Compare 2 entities for equalityclassTesteq (object):def __init__(self,age): Self.age=Age ; def __eq__(self, Other):ifself.age==Other.age:returnTrue; Else: returnFalse;a=testeq (5); b=testeq (6); C=testeq (5);Print(a==b);Print(A==C);
Small white learn Python creation class three