How does Python solve this problem

CSDN Q & A 2022-01-15 03:52:17 阅读数:676

python solve problem

problem :
Define a dog , And define the construction method in this class , Define the attribute name and color in the constructor , Color is a private property ( The default is white ), Then define a in dogs sit() Method , stay sit() Method to output the name of the dog 、 Color and sit down ( For example, there is a white dog barking kitty, The output format is :kitty It's white , Sit down !). Then create the husky class , Inherited from dogs , Finally, create instances of dogs and husky classes , And call sit() Method .




Refer to the answer 1:

Wu Jie , I have to hand in my homework , Are you finished ?




Refer to the answer 2:
版权声明:本文为[CSDN Q & A]所创,转载请带上原文链接,感谢。 https://pythonmana.com/2021/12/202112112234318385.html