f15e
09-21-2002, 07:33 PM
I am using C++.
Here's the setup. I have two classes(Customer and Book) for this bookstore program.
How, if at all possible, can I access the private members of each class within a regular function that is not part of either class.
My problem is that I am not allowed to do any input or output within the class functions. If I could do this I wouldn't be asking this question. So therefore I must use a function outside of the classes to input and output the data stored in the private members. For example, each block in my array Book bookInfo[] holds several bits of information on a particular customer. Now I can use a class fuction to test to see, for instance, if a customer is a member of the bookclub or not which is given by a Y or N. I search to see if there a member with a for loop. If the customer is a member, how can I send all of that customers information to a funcion outside of the classes?
Here's the setup. I have two classes(Customer and Book) for this bookstore program.
How, if at all possible, can I access the private members of each class within a regular function that is not part of either class.
My problem is that I am not allowed to do any input or output within the class functions. If I could do this I wouldn't be asking this question. So therefore I must use a function outside of the classes to input and output the data stored in the private members. For example, each block in my array Book bookInfo[] holds several bits of information on a particular customer. Now I can use a class fuction to test to see, for instance, if a customer is a member of the bookclub or not which is given by a Y or N. I search to see if there a member with a for loop. If the customer is a member, how can I send all of that customers information to a funcion outside of the classes?