The default constructor is the constructor that can be called with 0 parameters.
Your Customer constructor on line 17 requires 2 parameters.
Your City constructor on line 37 requires 3 parameters.
Therefore neither of these are default constructors.
Though you do not need a default constructor, really. You just have to call the parameterized constructors:
1 2 3 4 5 6 7 8
// This code is wrong:
Customer aCust; // <- this calls the default constructor
aCust.Customer(1572, "77777"); // <- this attempts to call a different constructor
// after aCust has already been default constructed (ie: this is wrong)
// You want to do this:
Customer aCust(1572, "77777"); // <- use parameterized constructor
THATS what was wrong. Thank you so much! He never showed us that you can initialize an object and use parameters to pass the data right from the object when you create it which was creating this whole mess to begin when you don't have/need a default constructor.
I was so confused but it makes a lot of sense now.
Awesome! Thanks again for the help you two! You saved me a lot of frustration.
Alright, I cleaned up the code and ran into a NEW issue: I can't get aTown.city or aTown.state to cout properly, however aCust has no issues couting the customer data 1572 and 77777
I fixed line 31 as well to:
friendvoid displayCust(Customer aCust, City aTown);
I changed main to:
1 2 3 4 5
Customer aCust(1572, "77777");
City aTown("Lucky", "Texas", "77777");
displayCust(aCust, aTown);
I actually had just caught the error myself after posting and looking at my other function. You are spot on! Program works 100% as intended now. Thank you for the help.
I accidently put in there just by force of habit, I need to stop doing that.