Problem with class function

I have a program I am working for the class I am taking. The goal is to create a default,paramertized and copy constructor for a resistor value. I have been unable to get it to pass the compiler due to one error,
" c:\documents and settings\mark\desktop\visual studio\week4\dilday_week 4\dilday_week 4\dilday_week 4.cpp(19) : error C2470: 'Class' : looks like a function definition, but there is no parameter list; skipping apparent body"

This error points to,
"class Resistor Class
{ " ,in the program. If I can get past this I can debug the rest of the code.Here is the full code, take it easy on my code I am new at this.

"// Dilday_Week 4.cpp : Defines the entry point for the console application.

#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <iomanip>


using namespace std;
double m_dResValue(double,double,double,double);
double silver = .005;
double gold = .01;




class Resistor Class
{

public:
string m_cResistorName;
void DisplayResistor(void);
void EnterResistance(void);
void EnterResistance(ResistorClass, ResistorClass);
ResistorClass();
ResistorClass(string Name, double nominalResistance, double Tolerance);
ResistorClass(const ResistorClass &ResistorClass);
~ResistorClass();

void EnterResistance (void);
void DisplayResistor(void );


cout<< " Resistor Value" <<endl;
cout<< "Minimum Value Resistor" <<endl;
cout<< "Maximun Value Resistor" <<endl;



system("PAUSE");


private:

double m_dResValue, m_dMinResistance, m_dResValue, m_dMaxResistance, m_dTolerance, multiplier;


void main(){

ResisorClass::ResistorClass(); // default constructor

}

m_dResValue = 1000
m_dTolerance = .1;


// Determine resistor value
m_dResValue = m_dResValue

// Determine minimum resistor value
m_dMinResistance = m_dResValue - (m_dResValue * multiplier);

// Determine maximum resistor value
m_dMaxResistance = m_dResValue + (m_dResValue * multiplier);


cout<<"\n\n";
cout<<"Enter Resistor Name (default):";
cin>>m_cResistorName;
cout<<"\ndefault constructor called\n";


ResisorClass::ResistorClass( double m_cResistorName, double nominalResistance, double Tolerance); // Paramertized Constructor

m_dResValue = nominalResistance;
m_dTolerance = Tolerance;
m_cResistorName = Name;

// Determine minimum resistor value
m_dMinResistance = m_dResValue - (m_dResValue * multiplier);

// Determine maximum resistor value

m_dMaxResistance = m_dResValue + (m_dResValue * multiplier);

cout<< "\nparamertized constructor called\n";



ResisorClass::ResistorClass( const ResistorClass &ResistorObject); // Copy Constructor


m_dResValue = ResistorObject.m_dResValue;
m_dTolerance = ResistorObject.m_dTolerance;
m_dMinResistance = ResistorObject.m_dMinResistance;
m_dMaxResistance = ResistorObject.m_dMaxResistance;

// Input Resistor Name
cout<<"\n\n";
cout<<"Enter Resistor Name (copy):";
cin>>m_cResistorName;
cout<<"\ncopy constructor called\n";

ResisorClass::~ResistorClass(){ // destructor
cout<<"\nndestructor call for " << m_cResistorName <<endl;
}
}

Resistor Class
That's a typo when you copied, right? You're not actually trying to use an identifier with a space in the middle. Right?
"That's a typo when you copied, right? You're not actually trying to use an identifier with a space in the middle. Right?"

That is what I thought, but when I correct it by removing the space I get 104 errors? Is there other problems with this name in other locations?
Where do I start?

void main() is not standard.
main() is inside a class declaration.
main() is explicitly calling ResisorClass's constructor, which is illegal.
There's a bunch of stuff which should be inside functions but are just lying around the class declaration.

What can I tell you? Reread the entire chapter on classes of your material.

I'll give you an example of what a properly written class looks like as there isn't much else I can do:
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
#include <iostream>

class A{
	int *data;
	A(int);
	~A();
	int getData();
};

A::A(int a){
	this->data=new int;
	*this->data=a;
}

A::A(int a){
	delete this->data;
}

int A::getData(){
	return *this->data;
}

//main() returning anything other than int is non-standard.
int main(){
	//A::A(); //<- Illegal
	A a;
	std::cout <<a.getData<<std::endl;
	return 0;
}
Topic archived. No new replies allowed.