so I am stuck at something that I think is easy.
Note: everything below is for C++11 and above.
Let us start. I have a class named "Employee". Its consctructor is as follows:
Employee::Employee(const string& first, const string& last, const string& ssn)
: firstName(first), lastName(last), socialSecurityNumber(ssn) {}
Furthermore, when trying to create the object, in my main, I do the following:
void main()
{
string firstName;
string lastName;
string socialSec;
Employee salariedEmployee{firstName, lastName, socialSec};
}
and I get the error:
error: cannot declare variable 'salariedEmployee' to be of abstract type 'Employee'
then I tried to create my object as a pointer, as followes:
Employee *salariedEmployee{&firstName, &lastName, &socialSec};
and get the error:
error: scalar object 'salariedEmployee' requires one element in initializer
I do not understand what I am doing wrong. I was used to coding is previous versions of C++11 but I am trying to learn these new tricks of using curly braces (uniform initialization). What am I doing wrong (in both cases)?
P.S. I have googled a lot but I am very confused about what to do. Two of the resourses I saved are these (but have read much more stuff):