Question: Need help with consumable. c p p #ifndef CONSUMABLE _ H _ INCLUDED #define CONSUMABLE _ H _ INCLUDED #include Item.h / * *
Need help with consumable.
#ifndef CONSUMABLEHINCLUDED
#define CONSUMABLEHINCLUDED
#include "Item.h
This class represents one Consumable Itemas found in most video games.
This includes food.
Consumable Items must be stackable.
class Consumable : public Item
private:
protected:
The effect recieved by using the Item.
std::string effect;
Number of time this Item can be used.
int uses;
public:
Default to a Comsumable Item with an empty name
Consumable;
Big
Consumableconst Consumable& src default;
~Consumable default;
Consumable& operatorConsumable& rhs default;
Retrieve effect
std::string getEffect const;
Set effect
void setEffectstd::string effect;
Retrieve number of uses
int getNumberOfUses const;
Set number of uses
void setNumberOfUsesint u;
Print the Consumable Item
void displaystd::ostream& outs const override;
Read Consumable Item attributes from an input stream
void readstd::istream& ins override;
bool isStackable const override;
Cloneie copythis Consumable Item
Item clone const override;
;
inline
std::string Consumable::getEffect const
return thiseffect;
inline
void Consumable::setEffectstd::string effect
thiseffect effect;
inline
int Consumable::getNumberOfUses const
return thisuses;
inline
void Consumable::setNumberOfUsesint u
thisuses u;
#endif
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
