阅读背景:

Python为单个对象/类创建多个实例

来源:互联网 

I'm using Python. I've read a bit about this and can't seem to wrap my mind around it. What I want to do is have a class called Potions with various potion objects in it. For now there's one potion, a simple HealthPotion. I want potions to be stackable in inventories and shop stocks. So I need an instance of the potion amount for an inventory and an instance for each shop stock that carries potions. The potion amount would be dynamic, for buying/selling and looting of potions. If someone could provide a basic explanation or examples that would be great. I'm using Python. I've read a bit about this an




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: