[英]When an object of a class has arguments, how do you pass it as an argument of a method in another class
This new class(CashRegister) should accept retail object as an argument how do I go about it the class in retail has 3 argument too这个新类(CashRegister)应该接受零售 object 作为论据,我如何 go 关于它,零售中的 class 也有 3 个论据
import retail
item = retail.RetailItem(desc, unit, price)
class CashRegister:
def purchase_item(self):
pass
def get_total(self):
pass
I am not sure if you are referring to inheritance, if is that in this link: https://www.w3schools.com/python/python_inheritance.asp you can find some examples of inheritance, hope it helps我不确定您是否指的是 inheritance,如果是在此链接中: https://www.w3schools.com/python/python_inheritance.asp您可以找到一些 Z5FED3411FAF0321721Z28B2 的示例,希望对您有所帮助04
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.