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 1 of 7.

Shashank said:   5 years ago
We have a friend class and function, not any constructor.

Constructors are of three types:
* Default Constructor.
* Parametrized Constructor.
* Copy Constructor.
(7)

Ankita Kumari said:   6 years ago
It's not a constructor.

Constructors are basically of 3 types:
1. Default Constructor (without arguments).
2. Parameterized Constructor (with arguments).
3. Copy Constructor.

It is a function called Friend Function.

Friend Function is used to access private members of two different classes for which it has been declared as a friend.
(7)

Sid said:   5 years ago
A constructor can not be defined outside the class so Friend constructor can't be define.
(5)

Amarnath Rokade said:   6 years ago
Note: There are main 3 types only.

1. Default.
2. Parameterless.
3. Parameterized.

Copy constructor is under Parameterized constructor.
(2)

Sneha Tiwari said:   8 years ago
Constructors, as we know have the same name as the class name. They can be three types of constructors namely:
1) Default constructor e.d constr() which has no parameters.
2) Parameterised constructors constr(x,y) that have some parameters passed to it.
3) Copy constructor constr(&object of constructor) that take input as the object of constructor type or rather copies the value of the constructor.

Friend functions exist but friend constructor don't exist in object oriented concept.
(1)

Vidyashree bs said:   7 years ago
A friend is a function, but not a constructor.
(1)

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

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

Default, parameterized and copy constructor.

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.


Post your comments here:

Your comments will be displayed after verification.