Question: Which of the following lines contains a syntax error? class Person { public: void SetNames(string n, string ln) { name = n; lastName = ln;

Which of the following lines contains a syntax error?

class Person {

public:

void SetNames(string n, string ln)

{ name = n; lastName = ln; }

void PrintName() const;

private:

string name;

string lastName;

};

void Person::PrintName() const {

name = name + lastName;

cout << name << endl;

return;

}

int main() {

Person p;

p.SetNames(Travis, Jones);

p.PrintName();

return 0;

}

Select one:

a. void SetNames(string n, string ln)

b. name = name + lastName;

c. p.SetNames(Travis, Jones);

d. p.PrintName();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!