Apr 27, 2014 at 5:46pm UTC
My program
//Customer.h
#include<string>
#ifndef CUSTOMER_H
#define CUSTOMER_H
using namespace std;
class Customer
{
int ID ;
string Name , Address ;
public:
Customer ();
void Set_name(string);
string Get_name();
void Set_address(string);
string Get_address();
void Set_id(int);
int Get_id();
};
#endif // CUSTOMER_H
//Customer.cpp
#include "Customer.h"
#include <iostream>
#include <string>
using namespace std;
Customer::Customer()
{
int I;
string Add;
string Nam ;
ID = I;
Address = Add ;
Name = Nam;
}
void Customer::Set_name(string n)
{
cout << "Please enter your name \t";
cin >> Name;
}
string Customer::Get_name()
{
return Name;
}
void Customer::Set_id(int i)
{
cout << "please enter your ID \t ";
cin >> ID;
}
int Customer::Get_id()
{
return ID;
}
void Customer::Set_address(string a)
{
cout << "Please enter your Address \t ";
cin >> Address;
}
string Customer:: Get_address()
{
return Address;
}
//Companies.h
#ifndef COMPANIES_H
#define COMPANIES_H
#include <string>
using namespace std;
class Companies: public Customer{
string License_Number;
public:
Companies();
void Set_license(string);
string Get_license();
};
#endif // COMPANIES_H
Companies.cpp
#include "Companies.h"
#include<iostream>
using namespace std;
Companies::Companies()
{
string Li;
License_Number = Li;
}
void Companies:: Set_license(string l)
{
cout << "Please enter your License Number \t ";
cin >> License_Number;
}
string Companies:: Get_license()
{
return License_Number ;
}
int main()
#include"Customer.h"
#include"Companies.h"
#include <iostream>
using namespace std;
int main ()
{
Customer x;
string e;
x.Set_name(e);
string s;
Companies d;
d. void Set_license(string s);
return 0;
}
Companies.h|8|error: expected class-name before ‘{’ token|
Last edited on Apr 28, 2014 at 5:54pm UTC
Apr 28, 2014 at 3:24am UTC
a) please use code tags
b) whats the problem
c) you have this line in your post: int main() right above #include "Customer.h". please tell me that that line means it is your main file and you didnt actually write it in another file?