MCQs > IT & Programming > C++ > Answer the question that follows. class Person { string name; int age; Person *spouse; public: Person(string sName); Person(string sName, int nAge); Person(const Person& p); Copy(Person *p); Copy(const Person &p); SetSpouse(Person *s); }; Which one of the following are declarations for a copy constructor?

C++ MCQs

Consider the sample code given below and answer the question that
follows.
class Person
{
string name;
int age;
Person *spouse;
public:
Person(string sName);
Person(string sName, int nAge);
Person(const Person& p);
Copy(Person *p);
Copy(const Person &p);
SetSpouse(Person *s);
};
Which one of the following are declarations for a copy constructor?

Answer

Correct Answer: Person(const Person &p);

Explanation:

Note: This Question is unanswered, help us to find answer for this one

C++ Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

C++ Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it