Can I override a class function without creating a new class in Python?

前端 未结 3 1553
我寻月下人不归
我寻月下人不归 2021-02-08 13:10

I\'m making a game in pygame and I have made an \'abstract\' class that\'s sole job is to store the sprites for a given level (with the intent of having these level objects in a

3条回答
  •  萌比男神i
    2021-02-08 13:29

    I'd suggest using a different class, via inheritance, for each level.

    But you might get some mileage out of copy.deepcopy() and monkey patching, if you're really married to treating Python like Java.

提交回复
热议问题