For whatever reason, I can't figure this out.
I'm getting this error:
error C2082: redefinition of formal parameter 'user'
In this code:
#pragma once
#include "Standard Libs.h"
#include "Ability.h"
#include "Spell.h"
#include "Item.h"
class Adventurer
{
private:
string name;
int level;
int xp;
int gold;
int attack;
int defence;
int max_hp;
int hp;
int max_mp;
int mp;
int max_tp;
int tp;
vector<Spell> spells;
vector<Item> items;
vector<Ability> abilities;
public:
Adventurer();
Adventurer(string user);
virtual void set_name(string user) { name = name; }
virtual void set_level(int level) { level = level; }
virtual void add_xp(int xp) { xp += xp; }
virtual void add_gold(int gold) { gold += gold; }
virtual void add_hp(int hp) { hp += hp; }
virtual void remove_hp(int hp) { hp -= hp; }
virtual void add_mp(int mp) { mp += mp; }
virtual void remove_mp(int mp) { mp -= mp; }
virtual void add_tp(int tp) { tp += tp; }
virtual void remove_tp(int tp) { tp -= tp; }
/*
virtual void add_spell(Spell);
virtual void add_item(Item);
virtual void add_ability(Ability);
*/
};
#include "Adventurer.h"
Adventurer::Adventurer()
{
name = "";
cout << "Default." << endl ;
cin.get();
}
Adventurer::Adventurer(string user)
{
name = user;
xp = 0;
level = 1;
gold = 50;
}
#include "Standard Libs.h"
#include "Adventurer.h"
class Warrior : Adventurer
{
public:
Warrior(string user);
};
#include "Standard Libs.h"
#include "Warrior.h"
#include "Adventurer.h"
Warrior::Warrior(string user)
{
Adventurer(user);
}
When I try to do:
Warrior war("Test");