I do not see what I am doing wrong here. I am not going to show the complete creation of my main function, because I do not think it will matter.
My problem is with this class that I am creating:
class employee { //create private variables for divider string firstName; string lastName; char gender; int dependants; double annualSalary; static int numEmployees; public: Benefit1 benefit; employee() { //create default values for varaibles firstName = "not given"; lastName = "not given"; gender = 'U'; dependants = 0; annualSalary = 2000; } employee(string first, string last, char gen, int dep, double salary, Benefit1 ben) { //allow input firstName = first; lastName = last; gender = gen; dependants = dep; annualSalary = salary; benefit = ben; } }
(Yes, Benefit1 was correctly called in the class.) My problem arises when I try to create an instance as employee2:
employee employee2("Mary", "Noia", 'F', "5", 24000.0, benefit1);
For some reason, my program will not allow me to put ANYTHING in the first place where the word "Mary" is. As you can see, the first instance, suppose, must be the first, so why doesn't it allow you to use anything?
David source share