Im getting the folowing error while trying to implement a friend function between two classes.
"Board.C: In member function ‘void Board::input(bool)’:
Board.C:227: error: ‘class Piece’ has no member named ‘castSpell’
make: *** [Board.o] Error 1"
Piece's Header file
#ifndef PIECE_H
#define PIECE_H
# include "Spellcaster.h"
# include <iostream>
#include <string>
#include<cmath>
using namespace std;
class Board;
class Piece
{
public:
string name;
bool Player;
Piece();
~Piece(){};
virtual bool validMove (int,int)=0;
virtual void move (int x, int y ){};
string symbol;
int xPos;
int yPos;
void setLife(int);
int getLife();
void Select();
void takeDamage(int);
bool caster;
bool secondaryAction;
friend void Spellcaster::castSpell();
private:
int life;
};
It has to use the function castSpell() from SpellCaster.h
#ifndef SPELLCASTER_H
#define SPELLCASTER_H
#include "Piece.h"
#include<iostream>
using namespace std;
class Spellcaster
{
public:
void castSpell(){cout<<"Spell Cast"<<endl;};
};
#endif // SPELLCASTER_H
Please help, been struggling for hours