擅长:python、mysql、java
<p>您可以显式地访问和使用<code>TopTest.count</code>,并且您的子类将坚持这种明确性。您可能需要考虑使用<code>type(self).count</code>,然后每个实例将使用自己类的变量,该变量可以在每个子类中变为不同的变量。在</p>
<p>要使子类有自己的类变量,只需在其定义中添加一个<code>count = 0</code>:</p>
<pre><code>class SubTest(TopTest):
count = 0
</code></pre>