[try Beta version]
Not logged in

 
Tips?

Sep 5, 2015 at 9:33am
Hello,
I've a question: I'm doing a project that permit to book a table in a certain restaurant. I have 4 classes: one final_user that is the main class; derived from this there are: client, restaurateur and administrator. My professor said that I have to implement also multiple inheritance but I don't know which connection could exist between 2 of these classes: client, restaurateur and administrator. Do you have some advices? Thanks in advance

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class final_user {
private:
	finale_user *U;
	int aceess(int D);
protected:
	int id;
	char username[15];
	char pw[10];
	char user_type;
	char name[MAX_CREDENZIALI];
	char surname[MAX_CREDENZIALI];
public:
	final_user();
	final_user(const final_user &X); 
	final_user(int K);
	char get_user_type();
	virtual void checkPrenotations(){};


If you want I can add also the other three classes
Last edited on Sep 5, 2015 at 9:40am
Sep 5, 2015 at 9:55am
restaurateur can be an administrator too.
Sep 5, 2015 at 9:56am
Adding the other classes would be nice.

But it sounds like you can have a base class (user) which has all the common methods and attributes e.g. id, username, pw, user_type, char get_user_type(), etc.
Then extending the base for the different connection functionality
Sep 5, 2015 at 10:14am
restaurateur can be an administrator too.
in the programm they are completely different. I know that is difficult to explain what I need but I'm searching a connection between ( for expample) restaurater and client ( that derived from final_user) that permit me to create a new class ( so I realize multiple inheritance that I have necessarly to include because my professor expect to use) that do something. Obviously can be added also an other class ( derived from final user) and combine it with client, restaurater or admin) which permit what I said in the first lines of this post.
The major problem is that it seems a forcing but I'm oblige to implement it otherwise the professor has one reason to reject me and I would avoid gladly.
Sep 5, 2015 at 10:42am
in the programm they are completely different
That is why you might need another class which allows restaurateur to perform administrative duties.

This is the point of MI: to allow single entity to be two completely different thing at once.

At least restaurateur + administrator makes more sense than any one of those + client.
Sep 5, 2015 at 10:51am
I make a try with a thing, however I really appreciate your care for my problem :)
Topic archived. No new replies allowed.