Answered step by step
Verified Expert Solution
Link Copied!

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 CONSUMABLE_H_INCLUDED
#define CONSUMABLE_H_INCLUDED
#include "Item.h"
/**
* This class represents one Consumable Item--as 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-3
Consumable(const Consumable& src)= default;
~Consumable()= default;
Consumable& operator=(Consumable& rhs)= default;
/**
* Retrieve effect
*/
std::string getEffect() const;
/**
* Set effect
*/
void setEffect(std::string effect);
/**
* Retrieve number of uses
*/
int getNumberOfUses() const;
/**
* Set number of uses
*/
void setNumberOfUses(int u);
/**
* Print the Consumable Item
*/
void display(std::ostream& outs) const override;
/**
* Read Consumable Item attributes from an input stream
*/
void read(std::istream& ins) override;
bool isStackable() const override;
/**
* Clone--i.e., copy--this Consumable Item
*/
Item* clone() const override;
};
//------------------------------------------------------------------------------
inline
std::string Consumable::getEffect() const
{
return this->effect;
}
//------------------------------------------------------------------------------
inline
void Consumable::setEffect(std::string effect)
{
this->effect = effect;
}
//------------------------------------------------------------------------------
inline
int Consumable::getNumberOfUses() const
{
return this->uses;
}
//------------------------------------------------------------------------------
inline
void Consumable::setNumberOfUses(int u)
{
this->uses = u;
}
#endif
Consumable.cpp is the most right image. Please do not use other answers on chegg as they are incorrect
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

In Problems 1118, mentally solve each equation. 7x = 21

Answered: 1 week ago

Question

Explain all drawbacks of application procedure.

Answered: 1 week ago

Question

Explain the testing process of accounting 2?

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago