In this question they ask me to use a input function with a single parameter of type istream, but if i do that, how do i invoke my second constructor based on what the user enteres in Input().
Should i not also include a reference to my class object i decalred in main()
within the parameters of Input() so that i may invoke my second construtor:
FOR EXAMPLE
int main()
{
CDAccount account; //this should use the default constructor and set my
//private member variables to 0, but i want to
//update this inside Input() to make it invoke the
//second constructor
account.Input(cin, account) //Can this be done for this question
//this way
return 0;
}
//IMPLEMNETATION
void CDAccount:
istream &cin, CDAccount &account)
{
//GET VALUES FOR RANDS, CENTS, TERM, RATE
//NOW ASSIGN THOSE VALUES AFTER CHECKING THAT THEY ARE CORRECT TO INVOKE
//MY SECOND CONSTRUCTOR AS FOLLOWS
account = CDAccount(RAND,CENT,TERM,RATE);
}
IS MY THINKING TOTALL OUT ON THIS OR NOT AND COULD SOME1 SUGGEST HOW I COMBAT THIS DIFFICULTY IM HAVING.SHOULD THE CLASS BE DECALRED INITIALLY AS IT WAS ABOVE?
thank you