Home > other >  Two class interaction, is to put the logic wrote one function in a class, or separately?
Two class interaction, is to put the logic wrote one function in a class, or separately?

Time:09-28

Such as a Packer packs class, class and a Weapon weapons, Packer has a function in the Pickup (Weapon _weapon) can loot Weapon, when objects are pick up all of members in the Packer and Weapon class to change, it should be wrote in the Pickup or all logic in the Weapon class to write a OnPick function, and then in the Packer. Subscribe to call in the Pickup OnPick is better?

CodePudding user response:

Separate refactoring crematorium warning!
  • Related