Click to See Complete Forum and Search --> : 'void RomanType::printDecimal(void)' : member function redeclaration not allowed


Videomm
July 21st, 2003, 01:40 PM
I trying to improve my OOP but all I have done is frustrate myself. I am trying to create a template (a sample project for learning OOP in Visual C++ .Net) by creating a Decimal to Roman numeral converter. I am receiving this Error “'void RomanType::printDecimal(void)' : member function redeclaration not allowed ” . This is probably simple oversight but I cannot see it. Can anyone help?

RomToDec.cpp



#include <iostream>
#include "roman.h"
using namespace std;


int main(void)
{
int n, i=0;

RomanType r1;
cout << "Enter your number: ";
cin >> n;
r1.setRoman(n);
r1.convertToDecimal();
cout << "Roman number is ";
r1.printRoman();
cout << "Decimal number is ";
r1.printDecimal();

return 0;
}



RomanType.h


#pragma once


class RomanType
{
public:

RomanType();
// default constructor
RomanType(string & rom);
// set the member variable decimal to the argument value and invoke convertToRoman
// to set the member variable st to the Roman numeral form
void setRoman(String & rom);
// sets decimal member variable to the argument value
void convertToDecimal();
// set the member variable st to the decimal numeral form of the value in decimal Roman
void printRoman();
// using cout display the Roman Numeral form
void printDecimal();
// using cout display the decimal form
private:
int decimal; //to store the decimal form
string roman; //to store the decimal form
char st[25]; //to store the Roman numeral form
};



RomanType.cpp


#include "roman.h"
#using <mscorlib.dll>

#include <iostream>

using namespace std;


RomanType::RomanType()
{
}
RomanType::RomanType(string & rom)
{
decimal = d;
convertToRoman();
}
void RomanType::setRoman(string & rom)
{
}

void RomanType::convertToDecimal()
{

}

void RomanType::printDecimal();
{
std::cout << "Decimal number is " << st << '\n';
}

void RomanType::printRomanl();
{
std::cout << "Roman number is " << st << '\n';
}


}




Thanks for any assistance provided

Mark

Paul McKenzie
July 21st, 2003, 03:13 PM
If this is C++, this could never compile:

#include
#include "roman.h"
//...
#include "roman.h"
#using
//...
// Extraneous } at the end of your code
}

If this is your actual code, then this is an error. If it isn't your actual code, please copy and paste your actual code (with the "code" blocks so that it looks neat) -- do not type it in.

Regards,

Paul McKenzie