擅长:python、mysql、java
<p>您的问题是<code>WithdrawCharge</code>实际上没有一个名为<code>withdraw</code>的方法。因此,当您从<code>MostEvilAccount</code>上的<code>withdraw</code>调用它时,Python必须搜索一个适当的方法,即<code>withdraw</code>在{<cd4>}上,因为传入<code>WithdrawCharge.withdraw_fee</code>的{<cd7>}是<code>MostEvilAccount</code>。举例说明:</p>
<pre><code>d = MostEvilAccount("Dave", 500.00, 1)
d.withdraw(5.00)
> In MostEvilAccount.withdraw at line 37
> In WithdrawCharge.withdraw_fee at line 33
> In MostEvilAccount.withdraw at line 37
> In WithdrawCharge.withdraw_fee at line 33
</code></pre>
<p>它还在继续。。。在</p>
<p>有几种方法可以解决这个问题。您可以使用<code>WithdrawCharge</code>的功能并将其嵌入<code>MostEvilAccount.withdraw</code>。您还可以将<code>Account.withdraw</code>作为参数传递给<code>withdraw_fee</code>,并让它调用它。在</p>