Help Please. There are 3 seperate files. Ive narrowed down the error.
Code:
#ifndef GUARD_Character_Info
#define GUARD_Character_Info
#include <iostream>
#include <fstream>
using namespace std;
class Character_Info
{
private:
char player_name[50]; //players name
public:
void name() //get players name
{
cout <<"Enter your players name."<<endl;
cin >>player_name;
cout<<"You have entered"<<endl<<player_name<<endl;
}
void infOut(int pn) // !!!!!!!!part of the error
{
ofstream charout;
charout.open("CHARACFILE.DAT", ios::app | ios::binary);
charout.write( (char*)this, sizeof(*this));
}
};
#endif
Code:
#include <iostream>
#include <conio.h>
#include "Intro.h"
#include "Character_Info.h"
using namespace std;
int main()
{
Intro I1;
I1.Display_Intro();
getch();
return 0;
}
Code:
#ifndef GUARD_Intro
#define GUARD_Intro
#include <iostream>
#include "Character_Info.h"
using namespace std;
class Intro: public Character_Info
{
private:
int ch; //users choice on switch
public:
void Display_Intro() // display and get name
{
cout <<" You have just entered the world of Lost Dungeons"<<endl;
cout <<" You will be taken on a long journey of trouble and danger."<<endl;
cout <<" If you are up to the task then select your choice (1 or 2):"<<endl;
cin >> ch;
switch (ch)
{
case 1:
Character_Info::name();
Character_Info::infOut(); //!!!!!other part of error
break;
case 2:
cout <<"Quitting program";
break;
default:
cout <<"ERROR";
}
}
here are my compiler errors
------------------------------------------------------------------------------------
3 C:\Dev-Cpp\Main.cpp
In file included from Main.cpp
C:\Dev-Cpp\Intro.h
In method `void Intro:isplay_Intro()':
25 C:\Dev-Cpp\Intro.h
no matching function for call to `Character_Info::infOut ()'
21 C:\Dev-Cpp\Character_Info.h
candidates are: void Character_Info::infOut(int)
C:\Dev-Cpp\Makefile.win
[Build Error] [Main.o] Error 1
------------------------------------------------------------------------------------
any help will be welcome. thank you in advance. i might not respond till tomorrow so i posted so that you can answer or look into it early.Thank you