Question: Class relationships
I would like to understand the best way to accomplish the relation between two entities.
Let's say we have an Account and a Customer. Every customer will have one account. Every account may have one or more customers.
For example:
Joe's Burgers is the account.
Joe's Burgers on 1st St. is a customer to the account.
Joe's Burgers on 2nd St. is a customer on the account.
In a database the Customers would have an account number that would link to the Joe's Burgers account.
Would it be best to have two independant classes or should they be connected in some way.
An example of how the classes would be used:
Code:
Customer customer(custNo);
char* name = customer.getName();
// and I am thinking something like
Account acct(customer.getAcctNo);
The difference is, is that the Account would contain billing information while the customer may contain delivery information.
I hope I made some sense there.
[edit]
The more I tihnk about it the more I am thinking I should just have two non related classes. I can get the account number from the Customer class and I would need to be able to get the Customer numbers from the Account class also. So I am not seeing how a relationship would make much sense. I'll leave this open incase i'm deadly wrong!