Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help with consumable.cpp Here is consumable.h #ifndef CONSUMABLE _ H _ INCLUDED #define CONSUMABLE _ H _ INCLUDED #include Item.h / * *
Please help with consumable.cpp
Here is consumable.h
#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
Consumable.cpp is the most right image. Please do not use other answers on chegg as they are incorrect
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started