CodePudding user response:
What is the problem? ,,,,,,,,CodePudding user response:
The problem is I don't understand this code running processes,CodePudding user response:
Is learning python, see together, the principle of estimation is to ask you the last two sentences,Actually, sentence by sentence according to the order and leave,
The first line declares the student object s, s is a student of an assignment with the constructor,
The structure, the first call person2 constructor to student s assignment (I don't understand to create person2 object), namely s.n ame=LCG; And then directly to s age assignment to 18. The final print out the first sentence "LCG age is 18"
Second statement of the object s function called getname, note s object is inherited from the person1, and not be redefined, the constructor, so whether the initial enter system all think this is s is person1 getname function, so the second sentence output is a function of person1 nature,
CodePudding user response:
The