C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 2)
2.
Which of the following is not a type of constructor?
Copy constructor
Friend constructor
Default constructor
Parameterized constructor
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
68 comments Page 4 of 7.

Priyanka patra said:   1 decade ago
Friend is not a constructor. It's a type of function which allow to access private data member variable of a class.

Sneha kuwar said:   1 decade ago
There are only three type of constructor. Default, parameterized and copy.

Kajal kale said:   1 decade ago
Because friend function are used to the join to to the class. Hence it is not type of constructor.

Ankit Maharshi said:   1 decade ago
"friend" is a keyword which is use for class & function. It is not a constructor type.

Chinmaya said:   1 decade ago
There are only 3 types of constructor.

Default, parameterized and copy constructor.

Gaurav said:   1 decade ago
Tell me something more about constructor or please explain about constructor.

Sanket said:   1 decade ago
All are type of constructor but friend is a type of function class type.

Kushal said:   1 decade ago
because friend are not constructors they are just used to access private data members of the classes.

Maddirala said:   1 decade ago
Friend constructors are not possible because this is the function not a class which is used for accessing private data and member variables outside class.

Shudhanshu shekhar said:   1 decade ago
There are three types of constructors:

1. Default constructor -->no parameter.

2. Parameterised constructor-->having parameters like arguments of a function.object is declared with blues for that arguments.

3. Copy constructor-->invoked when an object is copied to another object.

classname ob1;
ob2=ob1; /*copy constructor called*/

When an object is passed by value to a function then also copy constructor is invoked.

Note--> Array of objects can never be created without default constructor. If two default constructors are there i mean first having no argument and second having default argument then error will generated while creating array of objects.

So it is desirable to declare only one default constructor while creating array of objects.


Post your comments here:

Your comments will be displayed after verification.