0

In this .cpp i have an error saying member function cannot be redeclared. I dont know what it needs to get rid of the error obviously it needs a declaration somewhere but where?

#include <iostream>
#include <ctime>
using namespace std;


Monster::Monster(std::string Name, int health, int hitPoints,
		    int miss, int damage,const std::string& weaponName)

{
	Name = Name;
	hitPoints = hitPoints;
	Weapon weapon;
	miss = miss;
	damage = damage;
	weapon.Name = weaponName;



}

bool Monster::Death()
{
	return hitPoints <= 0;
}
std::string Monster::getName()
{
	return Name;
}


void Monster::attack(Player& player)
{
	{
    srand((unsigned)time(0));
    int random_integer;
    for(int index=0; index<1; index++){
    random_integer = (rand()%2)+1;
    cout << random_integer << endl;
    }

	cout << "A " << Name << " attacks you "
		 <<"with a " << weapon.Name << endl;

	int damage = weapon.weaponHitPoints;
	if(random_integer = 1)
	{
		Player.takeDamage;
		cout << "Your Health is minus: " << damage;
	}
	else if( random_integer = 2)
	{
		cout<< "You missed";
	}

	
	void Monster::takeDamage(int damage)
{
	HitPoints -= damage;
}

void Monster::displayHitPoints()
{
	cout << Name << "'s hitpoints = " << HitPoints << endl;
}


		
}
3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Moschops
0

You've screwed up your brackets and have some functions being defined within other functions.

Fix brackets.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.