reference to user is ambiguous
i am trying to inherit user class to staff,account&customer class
but when i am trying to access the values of user it gives error
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#include<iostream>
#include<fstream>
#include<ctime>
#include<iomanip>
#include<string>
using namespace std;
class User
{
private:
char username[30];
char name[30];
char pass[30];
string type;
public:
void dep(int);
void draw(int);
string month(int a);
void Title();
void login();
void intro();
};
class Customer:public User
{
private:
char ac_type;
public:
void customer();
};
class Account:public User
{
public:
void create_account(); //for Creating new account
void show_account()const;
void modify();
void report() const;
int retAcno()const;
int deposit()const;
char retType()const;
};
class Staff:public Customer,public Account,public User
{
public:
void write_account();
void display_sp(int);
void modify_account(int);
void delete_account(int);
void display_all();
void deposit_withdraw(int, int);
void check();
};
void Staff::check()
{
cout<<"Enter Username";
cin.getline(username,30);
}
int main()
{
user *u;
staff s;
u = &s;
u->check();
}
|
Last edited on
1 2 3 4 5
|
private:
char username[30];
char name[30];
char pass[30];
string type;
|
They are private, only that class can see them, you need gets() to access them
Last edited on
Topic archived. No new replies allowed.