Nested Class Construction problem
In this program, we use nested classes to represent rooms and customers in hotels. My current problem occurs in implementation, but I'm including the header file in case you guys see an error I don't in that.
My error comes in the implementation where I try to construct a customer with strings x and y. At x, there's a red line with the notation "Expected a ')'"; at y, there's a red line with the notations "this declaration has no storage class or type specifier"; and at the second ), the notation states "this declaration has no storage class or type specifier; expected a ';'".
What's causing this an how can I fix it?
Here is the header.
Code:
#pragma onceclass hotel
{
public:
hotel(void);
~hotel(void);
class customer
{
const string name;
string CCNum;
public:
customer(string x, string y);
~customer(string x, string y);
void changeCCNum (string x);
void getCCNum (string x);
void getName (string y);
void printReceipt (double z, string x);
};
class room
{
const int RNum;
const bool isSmoking;
double bill;
int occNum;
int nights;
public:
room(int x, bool y);
~room(void);
double getBill(int x, int y);
int getNights(int x);
int setNights(int x);
int getOccNum(int y);
int setOccNum(int y);
};
};
Here is the implementation as I have it so far.
Code:
#include "hotel.h"#include <string>
hotel::hotel(void)
{
}
hotel::~hotel(void)
{
}
hotel::customer(string x, string y)
{
name = x;
CCNum = y;
}
hotel::~customer(void)
{
}
hotel::room(int x, bool y)
{
RNum = x;
isSmoking = y;
}
hotel::~room(void)
{
}