Hey there, wonder if you can help me..
I have three classes:
1. Person
2. Accounts
3. Purchases
(Accounts and Purchases both inherit from Person)
You don't need an account to make a purchase but if you do you'll enter your: name, address etc..
The problem I'm having is association. The account will associate with the purchases and I'm thinking something like the object:
int main()
{
Purchases Receipt;
Account a;
cout << "Please enter your name: ";
cin >> name;
cout << "Please enter your age: ";
cin >> age;
cout << "Please enter your address: ";
cin >> address;
cout << "Please enter the Product ID: ";
cin >> product_id;
a.setName(name);
a.setAge(age);
a.setAddress(address);
a.setProduct(product);
Receipt.setValues(name, age, address, product);
cout << Receipt.getValues() << endl;
All these values are stored in the different classes.
In the functions for purchases there will be a function like:
Purchases::setValues(char theName[], int theAge, char theAddress[], int theProduct)
{
strcpy(name, theName[]);
age = theAge;
strcpy(address, theAddress[]);
product = theProduct;
}
Is that Association or have I missed the point?
Thanks guys