Accessing class object elements from a private array class C++ -
I have a class bank account and one of my personal members is bank account * customer [10]. I want to place the objects of the bank account (strings, int a, double c, double r, double s) inside the array and then want to access each individual piece data such as getString () or string with getAccountNum). I was trying a lot of things but I got a blank black box. How can I insert objects into a private class array?
# bank account. "Bank Account :: Bank Account (): Client () {} Zero Bank ACC :: Job () {string N =" Name "; String * nn = & amp; bank; Bank Account * B = New Bank Account (NN ); Bank Account: (String * N) {name = n;} String Bank Account: getName () {Return * Name;} Zero Bank Account: Go () {string st = customers [0] - & gt; GetName (cout & lt; ct & lt; & lt; endl;}
First create your member variable xray of the bank account. If you do not know how to use Points, then do not use it. You can still put it in the 'Bank Aquant' array, even if it is not indicative-type, you still get the same result.
bank account: bank account (): customer () {} zero bank account :: work () {string n = "name"; bank account * b = new bank account (); // Do it b = new bank account (n); // do not do this (above 'b' memory leak bank account one [1]; // Not necessarily [0] = * b; // and this customer [0] = A; // Assign 'A' instead of 'A' // Is your member variable number of client bank account? Just add the method to set up 'name' or use this customer [0] .name = n; 'You still have your member variable' name '}
bank account :: bank account (string n) {bank account nn; If you want to set the value of your member variable 'name', then also 'name = n;' You do not need to make a new installation of the bank account.} StringAccount :: getName () {Return name; // This is your only true thing} Zero Bank Account :: Go () {Bank Account B; // dot string string = BC customer [0] - & gt; Mix (); // Almost if you want to get the name of the customer '[0]', then just this string whistle = customers [0] - & gt; GetName (); Use 'or you can easily print out' cout & lt; & Lt; Customers [0] - & gt; Name & lt; & Lt; Endl; 'Cout & lt; & Lt; St. and LT; & Lt; Endl; } I think the example of 'bank account' and pointers' has been used when you are wrong here. If you want to use member variables, you do not need a new installation (if you get a value from a new instance, the output will be different).
For more detailed information, try reading the C ++ basics.
I am using my phone now, so forgive me if I can not understand better. I hope it will help. And I hope you get the code to do the right thing. There is still a lot of work needed for this.
Comments
Post a Comment