hi guys

I got this weird error which I cannot debug in my code. The program is to convert Roman numerals to Arabic numerals using the Interpreter design pattern. Here is a part of the program where the errors occurs

RNInterpreter.C:8: error: new types may not be defined in a return type
RNInterpreter.C:8: note: (perhaps a semicolon is missing after the definition of ‘Thousand’)
RNInterpreter.C:8: error: two or more data types in declaration of ‘RNInterpreter’

I know what the error means but I can't seem to find it.The default constructor doesn't have a return type where I made objects of the classes but the error occurs there

any help will be appreciated!Thanks

#include "RNInterpreter.h"
#include "Thousand.h"
#include "One.h"
#include "Hundred.h"
#include "Ten.h"

	thousands = new Thousand(1);
	hundreds = new Hundred(1);
	tens = new Ten(1);
	ones = new One(1);

which is the implementation file of this header file(only part of the file is shown above):


#include <cstring>

class RNInterpreter
		int interpret(char*);
		virtual void interpret(char* input,int&total);

		RNInterpreter* thousands;
		RNInterpreter* hundreds;
		RNInterpreter* tens;
		RNInterpreter* ones;

		char one();
		char* four();
		char five();
		char* nine();
		int multiplier();


>> RNInterpreter.C:8: note: (perhaps a semicolon is missing after the definition of ‘Thousand’)

Your compiler is suggesting that Thousand.h looks like

class Thousand
  // All your Thousand stuff here ...

} // <--- ... but no ending semicolon after the curly bracket

ah man...I hate such small mistakes

Thanks for the quick help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.