ISRO Computer Science (CSE) 2013 - Question 75

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2013

What is the right way to declare a copy constructor of a class if the name of the class is MyClass?

  • A. MyClass(constant MyClass *arg)
  • B. MyClass(constant MyClass &arg)
  • C. MyClass(MyClass arg)
  • D. MyClass(MyClass *arg)

Answer: B. MyClass(constant MyClass &arg)

Explanation: Copy constructor takes a reference to an object of the same class (const MyClass &arg).

| | All questions of ISRO Computer Science (CSE) 2013