LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   cpp error (https://www.linuxquestions.org/questions/programming-9/cpp-error-232258/)

ashirazi 09-18-2004 04:58 PM

cpp error
 
Hey,

I have a class called StateUtil and im trying to inherit this into Model class, but its not working. I get an error:

Model.h:10: base class `StateUtil' has incomplete type

Any idea?????

Thanks
raven

Code:

#ifndef STATEUTIL_H
#define STATEUTIL_H

class StateUtil;
#include "States.h"

class StateUtil {
        public:
                NullCalc *_state;
                StateUtil();
                void set_state(InitialState *iState);

};

#endif

Code:

class Model;
#include "States.h"
#include "Operators.h"
#include "CalculatorEngine.h"
#include "StateUtil.h"

class Model : public StateUtil{

        private:


leonscape 09-18-2004 05:49 PM

Remove forward declarations from these files. You should use forward declarations, above other classes, when your not including the header file, not in the header files for the actual classes, and then only if you actually refrence the class in the declaration of the other.

If that makes sense to you... :D


All times are GMT -5. The time now is 05:56 PM.