Logo F2FInterview

C Interview Questions

Q   |   QA

Copy constructors are called in following cases: 

  1. when a function returns an object of that class by value
  2. when the object of that class is passed by value as an argument to a function
  3. when you construct an object based on another object of the same class
  4. When compiler generates a temporary object

default ctor
copy ctor
assignment operator
default destructor
address operator

constructor with a single argument makes that constructor as conversion ctor and it can be used for type conversion.

For example:

class Boo  {
  public:
    Boo( int i );
};

Boo BooObject = 10 ; // assigning int 10 Boo object

Empty string

5794

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: