Почему я продолжаю получать сообщение об ошибке компилятора "error: ожидаемое имя класса до '{' token"? - PullRequest
0 голосов
/ 25 сентября 2019

Я просто пытаюсь унаследовать открытые функции-члены от класса ArrayBag, но я продолжаю получать эту ошибку "ожидаемого имени класса".Я включил файл и проверил орфографию, но ошибка все еще сохраняется.Я также убедился, что я включил соответствующие файлы заголовков, где я их использовал.

#ifndef _ZOORECORD_HPP_
#define _ZOORECORD_HPP_

#include "ArrayBag.hpp"
#include "Animal.hpp"
#include <fstream>
#include <string>

class ZooRecord : public ArrayBag 
{
    public: 
        // default constructor
        ZooRecord();

        /**
        parameterized constructor
        @pre the input file is expected to be in CSV
        (comma separated value) format as:
        "animal_name,hair,feathers,eggs,milk,airborne,aquatic,predator,toothed,
        backbone,breathes,venomous,fins,legs,tail,domestic,catsize,class_type\n"
        @param input_file_name the name of the input file
        @post adds Animal objects to record as per the data in the input file
        **/
         ZooRecord(std::string input_file_name);

        /**
        @post displays all animals in record, one per line by calling animal's
        display method”
        **/
        void display(); 
};

#endif
#ifndef _ZOORECORD_HPP_
#define _ZOORECORD_HPP_

#include "ArrayBag.hpp"
#include "Animal.hpp"
#include <fstream>
#include <string>

class ZooRecord : public ArrayBag 
{
    public: 
        // default constructor
        ZooRecord();

        /**
        parameterized constructor
        @pre the input file is expected to be in CSV
        (comma separated value) format as:
        "animal_name,hair,feathers,eggs,milk,airborne,aquatic,predator,toothed,
        backbone,breathes,venomous,fins,legs,tail,domestic,catsize,class_type\n"
        @param input_file_name the name of the input file
        @post adds Animal objects to record as per the data in the input file
        **/
         ZooRecord(std::string input_file_name);

        /**
        @post displays all animals in record, one per line by calling animal's
        display method”
        **/
        void display(); 
};

#endif
...