C++ Programming - OOPS Concepts - Discussion

Discussion :: OOPS Concepts - General Questions (Q.No.2)

2. 

Which of the following is not a type of constructor?

[A]. Copy constructor
[B]. Friend constructor
[C]. Default constructor
[D]. Parameterized constructor

Answer: Option B

Explanation:

No answer description available for this question.

Madhu Pal said: (May 6, 2012)  
Because rest of all are the types of constructor.

Suneetha said: (May 18, 2012)  
Rest of all are the types of constructor and friend is function.

Srikanth said: (May 23, 2012)  
Constructor's cannot have type or qualifiers. Hence nothing can precede constructor including void.

Sanjaya said: (May 30, 2012)  
We have friend class and function, not any constructor.

Sudhir Kumar Kushwaha said: (Jun 2, 2012)  
Only three type of constructor.
Copy constructor
Default constructor
Parameterized constructor

Suresh said: (Jun 9, 2012)  
Constructor are used to initialize the object. The Friend constructor is not available as a constructor. Friend is function. which use to access the data and methods of the defined class.

Ajitha said: (Jun 14, 2012)  
Because friend function is named as private in access the data in defined class.

Guru said: (Jul 22, 2012)  
What's the work of Parameterized constructor ?

Nagesh said: (Aug 10, 2012)  
Parameterized constructor is just like default constructor but allows the parameters just like functions with parameters.

Ravinder Gurjar said: (Aug 20, 2012)  
Only for three type constructor in j2se.

Defoult, parameterized, copy constructor.

Frinds connstructor is not constructor.

Vigneshwar said: (Aug 22, 2012)  
Friend is not a constructor its a function...
Remaining all option to be under the constructor type...
Constructor is used to invoke the object..

Pooja Naokar said: (Sep 5, 2012)  
There are 3 types of constructors

1. Default constructor with no parameters.
2. Parameterized constructor as its name implies with
one or more parameters.
3. Copy constructor which takes reference of object as
parameter.

And Friend is a funcion to access private members of 2 different classes to which it has been declaredas friend.

Sujit Kumar said: (Oct 1, 2012)  
Friend is not a constructor its a function.

Remaining all option to be under the constructor type.

Constructor is used to invoke the object.

Manu said: (Oct 11, 2012)  
Because friend function is used not constructor.

Pradeep said: (Oct 30, 2012)  
Friend Keyword is used for class and Functions. Rest of the 3 options are available constructor in c++.

Sahithi said: (Jan 13, 2013)  
Friend is a function but it is not a constructor.

Sushil Sinha said: (Jan 20, 2013)  
Friend is not a constructor. It is just a function. All options except friend are types of constructor.

Kapil Jat said: (Jan 27, 2013)  
Friend is only function not a create constructor.

Sumesh Sg said: (Mar 13, 2013)  
Because friend is a non member function.

It is a function and not a constructor.

Since there are 3 types of constructor i.e.

1. Parameterized constructor.
2. Default constructor.
3. Copy constructor.

Varun Vivek J said: (Mar 22, 2013)  
Friend is a function.

Where as all others are constructors.

Its a pre defined function and can be used to create functions whereas, constructors are used for functions itself!

Laxmikant said: (Apr 2, 2013)  
The only three constructor the friend constructor is a not constructor it is a function.

Lalit said: (Apr 25, 2013)  
Friend is a function, not a class & constructor is used with class, constructor is a function that create a object.

Vidya V Nair said: (May 15, 2013)  
What is a friend function?

Preetham said: (Jul 17, 2013)  
What is copy constructor?

Gautam Kanawade said: (Aug 6, 2013)  
Why constructor does not have any return type?

Lachu said: (Sep 18, 2013)  
The use of parameterized constructor is passing the values to the function.

Siva said: (Dec 13, 2013)  
What is the function of virtual function?

Swati said: (Dec 19, 2013)  
Friend keyword is use to create a friend function or friend class, it is not a type of constructor.

Ganesh Vahinde said: (Jan 5, 2014)  
Friend is not a constructor it is the function, which allows to use the private data out side the class.

Hemu Jai said: (Jan 14, 2014)  
What is the purpose of three constructor? what is the definition ?

Priyanka Patra said: (Jan 17, 2014)  
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: (Jan 20, 2014)  
There are only three type of constructor. Default, parameterized and copy.

Kajal Kale said: (Feb 13, 2014)  
Because friend function are used to the join to to the class. Hence it is not type of constructor.

Ankit Maharshi said: (Mar 11, 2014)  
"friend" is a keyword which is use for class & function. It is not a constructor type.

Chinmaya said: (May 5, 2014)  
There are only 3 types of constructor.

Default, parameterized and copy constructor.

Gaurav said: (Jun 12, 2014)  
Tell me something more about constructor or please explain about constructor.

Sanket said: (Aug 20, 2014)  
All are type of constructor but friend is a type of function class type.

Kushal said: (Aug 30, 2014)  
because friend are not constructors they are just used to access private data members of the classes.

Maddirala said: (Nov 9, 2014)  
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: (Mar 18, 2015)  
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.

Rajput Yogesh said: (Aug 3, 2015)  
1. Constructor.

2. Copy constructor.

3. Default constructor.

4. Parameterized constructor, only three type of constructor also friend is a special member function are there.

Yogesh Rajput said: (Aug 3, 2015)  
Only three type of constructor are, friend is a special member function, so it is a right answer.

Neelam said: (Aug 27, 2015)  
Total three types of constructor is there.

Neelam said: (Aug 27, 2015)  
Any other constructors?

Thazaar said: (Sep 11, 2015)  
Constructors are used to initialize the object whereas friend function is used to access the private data member of the classes.

Jitendra Kumar said: (Nov 8, 2015)  
C++ have only three type of constructor:

1. Copy constructor.

2. Default constructor.

3. Parameter constructor.

Raman said: (Nov 29, 2015)  
The dynamic constructor is not in this? Why?

Satya said: (Jan 26, 2016)  
The default object is constructor.

Sakshi Jain said: (Apr 1, 2016)  
Default, Parameterized, and Copy constructor are the constructor types of C++.

Akash Dhule said: (Apr 21, 2016)  
Remaining options are types of constructor and friendly is a function.

Afsha said: (Aug 11, 2016)  
Friend is a function not constructor.

Nitika Singh said: (Aug 27, 2016)  
We can pass the value as a parameter of the constructor, but it's not a type of constructor.

Akhilesh Kesarwani said: (Sep 8, 2016)  
The friend is not a constructor because it is a function.

Logi said: (Sep 24, 2016)  
Friend is a function.

Prashant said: (Nov 25, 2016)  
The friend is not a constructor because friend is an access specifier and they used in asp.net.

Farid said: (Jan 4, 2017)  
What is constructor explain with example?

Chetna Borse said: (Jan 25, 2017)  
Constructor is used to initialize the objects and the name of the constructor is same as the name of the class. And we can say construct the values of data members.

for eg. class demo
{
int a;
demo()
{
a=0
}
};

In this example, demo is the class and the name with parentheses is the constructor.
Whenever we create the object of the class demo the constructor will be called and assign value 0 to variable a.

Siva said: (Feb 7, 2017)  
What are the keys using inheritance?

Sneha Tiwari said: (Apr 14, 2017)  
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.

Anita said: (Jun 22, 2017)  
Friend constructor is not a type of constructor.

Rambabu Yadav said: (Sep 7, 2017)  
class Y
{
public:
Y();
};
class X
{
private:
void foo() {}
friend Y::Y();
};
Y::Y()
{
X x; x.foo();
}

As per 11.3 Friends [class.friend]


When a friend declaration refers to an overloaded name or operator, only the function specified by the parameter types becomes a friend. A member function of a class X can be a friend of a class Y.

[ Example:

class Y {
friend char* X::foo(int);
friend X::X(char); // constructors can be friends
friend X::~X(); // destructors can be friends
};

"end example ]

Vidyashree Bs said: (May 19, 2018)  
A friend is a function, but not a constructor.

Faisal Baloch said: (Oct 7, 2018)  
Because Constructor has three types:

1. Default Constructor.
2. Parameterized Constructor.
3. Copy Constructor.

Sharvari said: (Feb 22, 2019)  
The friend is not a type of any constructor. Right? If not please explain in detail.

Ankita Kumari said: (Apr 17, 2019)  
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.

Amarnath Rokade said: (Sep 26, 2019)  
Note: There are main 3 types only.

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

Copy constructor is under Parameterized constructor.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.