Error: Function is inaccessible

Я получаю эту ошибку, но я думал, что получу ее, только если уровень защиты участника будет слишком высоким и сделает его недоступным, но я все равно получаю это.

Shopable.h:

#ifndef _SHOPABLE_H_
#define _SHOPABLE_H_

#include "Library.h"

class Shopable{
private:
    std::string Name;
    int Cost;
    std::string Description;
public:
    std::string getName() const{return Name;}
    int getCost() const {return Cost;}
    virtual std::string getDesc() const = 0;
};

#endif

Weapon.h:

#ifndef _WEAPON_H_
#define _WEAPON_H_

#include "Globals.h"
#include "Shopable.h"

class Weapon : Shopable{
private:
    int Damage;
public:
    Weapon(int Cost,int Damage,std::string Name) : Cost(Cost), Damage(Damage), Name(Name){}
    std::string getDesc() const{
        return getName()+"\t"+tostring(Damage)+"\t"+tostring(Cost);
    }
    int Damage(Entity *target){
        int DamageDealt = 0;
        //do damage algorithm things here
        Special();
        return DamageDealt;
    }
};

#endif

Некоторая строка в случайной функции с правильным включает:

std::map< std::string, Weapon* > weapons;
Weapon* none = new Weapon(0,0,"None");
weapons[none->getName()] = none;

Ошибка с getName () - "Ошибка: функция 'Shopable :: getName' inaccessible "

25
задан pighead10 30 April 2011 в 21:01
поделиться