I don't see a problem with that code. It is legal and ok for a class to return a string like that.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Alas, your attempts to get direct access to the class Account private members display only your C++ and OOP knowledge (and programming skill level ;) ). The Account class designer declared public interface to ordinar class clients. Nobody should try to get more: that's class designer decision. Do you want to get customer data? Use getCustomer() member function. It returns a const pointer to C-string. Is it customer member value? Mind your own business, it's my private member - said class Account designer...
May be it helps you to understand one of the most fundamental OOP concepts - incapsulation ;)
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
Storm in a teacap. Totally absurd code and its "rationale":
Account data = new Account[arraySize];
I tried to do that as a final resort because even public functioncs of the Account class are giving errors while reading into the customer, private member of Account. I get a Access violation saying the memory could not be read. Any suggestions? It seems like my Array, savings is not working properly.
Are you sure that an even number of errors helps you to write correct codes? You have run-time errors. Why you are trying to play with program syntax in that case? Access violations do not bear a relation to a private or public member access rules. Have you ever seen the Debug menu choice?
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348