• +91 9723535972
  • info@interviewmaterial.com

C Interview Questions and Answers

Question - How to Copy constructor ?

Answer - A copy constructor is used to create an instanc... A copy constructor is used to create an instance from another instance, e.g.: MyClass A; MyClass B (A); When B is instantiated, the following constructor is called: B (B const & object); Use the body of the copy constructor to copy member data from the source object. e.g.: class Ints { int x, y; Ints (Ints const & object) { x = object.x; y = object.y; } };

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners