I'm having trouble with multiple inheritance. I'm supposed to write a program for chatrooms, the situation being this:
-A chatroom contains a name, a list of users, an administrator and a list of messages. It can be either private, requiring a password, or open.
-A user has a name and possibly a password.
-An adminstrator is a user that in addition has a list of chatrooms that he is adminstrating.
My problem is that a chatroom contains an administrator, but an administrator also contains a list of chatrooms! How can I solve this?
My first idea has to do like for struct which allows me to predefine administrator so that I can use administrators in the definition of a chatroom structure. But I don't think this works for classes (I can't write class Admin; and then include an Admin-vector in a chatroom)?
Thanks, I think the last answer wouldn't be a good solution, because afterwards I'm asked to create functions for the different objects, so I'll have to use class instead of struct. So for the pointers, my class Admin will contain a real user while the class Chatroom will contain a pointer to an Admin, right?
Ok, but is there also a way to solve the problem using class instead of struct? And can I really use struct just like I would use class?
I still don't really get how using pointers will help me. What difference does it make that your struct Chatroom contains pointers to Admin instead of Admin? My code so far is below, but it obviously doesn't work, since Admin hasn't been defined before Room. I also tried a predefinition like with struct, inserting "class Admin;" at the very beginning, but it seems this isn't valid.