#include <iostream>
#include <string>
#include <vector>
#include <memory> // **** added

class Object
{
protected:
    std::string name;
	int id;
	int value;


public:
	virtual ~Object() // **** needs to be virtual
	{
	}

	virtual void Display() const // made const-correct
	{

	}

};

class Weapon : public Object
{
private:
	int damage;
	float speed;


public:
	Weapon(std::string newName, int newValue, int newDamage, float newSpeed)
	{
		name = newName;
		value = newValue;
		damage = newDamage;
		speed = newSpeed;
	}

    /****
	~Weapon() // **** implicitly overridden
	{
	}
	****/

	void Display() const override // ****
	{
		std::cout << "Name: " << name << std::endl;
		std::cout << "Value: " << value << std::endl;
		std::cout << "Damage: " << damage << std::endl;
		std::cout << "Speed: " << speed << std::endl;

	}

};

int main()
{
	std::vector< std::shared_ptr<Object> > inventory; // modified

	//Weapon BronzeDagger("Bronze Dagger", 5, 1, 1); // ****
	//inventory.push_back(BronzeDagger); // **** modified
	inventory.push_back( std::make_shared<Weapon>( "Bronze Dagger", 5, 1, 1 ) ) ; // ****
	inventory.push_back( std::make_shared<Weapon>( "Golden Sword", 500, 10, 2 ) ) ; // ****

	// for(int i = 0; i < inventory.size(); i++) // ****
	for( auto p : inventory )
	{
		//inventory[i].Display(); // ****
		p->Display();
        std::cout << '\n' ;
	}
}
