Problem with inheritance

I have these two classes, one which is derived from the other. When I try to compile I get the error:
In file included from /home/michael/ASD/Lsystems/include/Definition.h:5,
from Definition.cpp:1:
/home/michael/ASD/Lsystems/include/Production.h:16: error: expected class-name before '{' token

Here are the header files:
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
//Definition.h
#ifndef _____DEFINITION_____H___
#define _____DEFINITION_____H___

#include "Production.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <stdlib.h>
#include <sstream>
#include <map>


class Definition
{
	protected:
	std::map<std::string, std::string> RuleMap;
	int Angle;
	int Generations;
	std::string Axiom;
	public:
	Production Prod;
	Definition(){};
	~Definition(){};
	Production prod;
	void SetAngle(int);
	void SetGenerations(int);
	void SetAxiom(std::string);
	void SetMap(std::string _Rules[2]);
};

#endif 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//Production.h
#ifndef _____PRODUCTION_____H___
#define _____PRODUCTION_____H___


#include <iostream>
#include <fstream>
#include <vector>
#include <stdlib.h>
#include <sstream>
#include <map>
#include "Definition.h"


class Production : protected Definition
{
	private:
	std::string new_axiom;
	public:
	void hello();
};


#endif 


I've looked up the error online and tried various approaches, but this is my first time using inheritance.
Any help is appreciated.
I think the problem is that you are including Production.h in Definition.h
Thanks Bazzy, I removed Production.h from Definition.h and it gave me this error:

In file included from Definition.cpp:1:
/home/michael/ASD/Lsystems/include/Definition.h:21: error: 'Production' does not name a type

closed account (z05DSL3A)
Production inherits from Definition but Definition has Production for a member!
Ahh of course, that's pretty obvious. Thanks
I have it working(ie. it inherits) although I ran into a new problem.
The members within Definition get assigned by the member functions, but in the Production class I am only getting their addresses.
For example if within Definition I set Angle = 20, then within Production::hello() I have the line:
cout << Angle << endl;
this prints out a long address rather than 20.
Personally I've never actually inherited a class in code myself (I've never felt the need to do so yet, I'm sure I will some day), so I don't know if that behavior is expected, but if its printing a memory address then reference Angle (&Angle) and it should print it's value.
I don't think it's printing an address. I think that perhaps you have no set it's value correctly before trying to print it. An uninit'd variable will have a strange value.

Can you give us the snippets of relevant code,
Topic archived. No new replies allowed.