class RandomFleet : public PlaceFleet
{
This is my RandomFleet which needs to inherit from Placefleet. (this is in RandomFleet.h)
my error: invalid use of undefined type ‘class Battleships::PlaceFleet’
I’ve included “PlaceFleet.h”
I’ve tried class Battleships::RandomFleet : public BattleShips::PlaceFleet
I can’t figure out why it won’t inherit properly.
EDIT: Also not PlaceFleet and RandomFleet both are part of ‘Battleships’ namepsace – I am not “using namespace Battleships” so I suspect this has something to do with it?
EDIT WITH CODE:
#ifndef PLACEFLEET_H_
#define PLACEFLEET_H_
#include"Place.h"
#include"Board.h"
class Battleships::PlaceFleet
{ //Functions and variables };
#endif
//above is PlaceFleet.h, below is RandomFleet.h
#ifndef RANDOMFLEET_H_
#define RANDOMFLEET_H_
#include"PlaceFleet.h"
class RandomFleet : public PlaceFleet
{//This is where compiler shows error
//Functions and variables
};
#endif
It was because I wasn’t using
(I tried to do class Battleships::PlaceFleet)