1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
//Class header
#include<cstring>
#include<string>
#ifndef CARD_CLASS_H_INCLUDED
#define CARD_CLASS_H_INCLUDED
using namespace std;
class Card //Abstract base class
{
protected:
string sName;
string sCard_num;
char cLimit;
short int nOwn;
//Access Functions. Protected as they are not used by non-member functions
string Getname(){return sName;}
string Getnumber(){return sCard_num;}
char Getlimit(){return cLimit;}
short int Getstock(){return nOwn;}
public:
//Constructors & destructor
Card(){sName="Unknown"; sCard_num="00000000"; cLimit='-'; nOwn=0;}
Card(const string &title,const string &cnum, char restr, short int stock)
{sName=title; sCard_num=cnum; cLimit=restr; nOwn=stock;}
~Card(){}
};
class Monster: public Card
{
protected:
short int nAttribute;
short int nLevel;
short int nMonsterType;
short int nTuner;
short int nAttack;
short int nDefence;
//Access Functions
short int GetAttr(){return nAttribute;}
short int GetLvl(){return nLevel;}
short int GetType(){return nMonsterType;}
short int GetTuner(){return nTuner;}
short int GetAtk(){return nAttack;}
short int GetDef(){return nDefence;}
public:
//Constructors & Destructors
Monster(){nAttribute=0;nLevel=0;nMonsterType=0;nTuner=0;nAttack=0;nDefence=0;}
Monster(short int attr, short int lvl, short int mtype, short int tuner,
short int atk, short int def, string &title, string &cnum, char restr,
short int stock):Card(title, cnum, restr, stock)
{nAttribute=attr;nLevel=lvl;nMonsterType=mtype;nTuner=tuner;nAttack=atk;nDefence=def;}
~Monster(){}
};
class Effect_Monster: public Monster
{
private:
string sMonster_Effect;
public:
Effect_Monster(){sMonster_Effect="None";}
Effect_Monster(string &meffect, short int attr, short int lvl, short int mtype,
short int tuner, short int atk, short int def,string &title, string &cnum,
char restr, short int stock): Monster(attr, lvl, mtype, tuner, atk, def, title,
cnum, restr, stock)
{sMonster_Effect=meffect;}
/*Constructor using an already created monster class.
This is where the error turns up.*/
Effect_Monster(char *meffect, const Monster &v): Monster(GetAttr(), GetLvl(),
GetType(), GetTuner(), GetAtk(), GetDef(),
/*This is divided here because the division is here in the original code and
the error is on the following line accorrding to the debugger*/
Getname(), Getnumber(), Getlimit(), Getstock())
{sMonster_Effect=meffect;}
};
| |