我有一个抽象类ship
。
from abc import ABC, abstractmethod
class ship(ABC):
def __init__(self):
...
@abstractmethod
def do_stuff(self,stuff,things):
pass
我有多个继承自它的类(destroyer
, cruiser
, patrol_boat
, 等等...)
class carrier(ship):
def __init__(self):
....
def do_stuff(self,stuff,things):
....
目前,如果我要添加,让我们def do_more_stuff(self):
说ship
class ship(ABC):
def __init__(self):
...
@abstractmethod
def do_stuff(self,stuff,things):
pass
@abstractmethod
def do_more_stuff(self,stuff,things):
pass
在我将它们重新输入控制台之前,这些更改不会影响任何子类。我该如何改变?