C++ Programming - Constructors and Destructors - Discussion

Discussion :: Constructors and Destructors - General Questions (Q.No.1)

1. 

A constructor that accepts __________ parameters is called the default constructor.

[A]. one
[B]. two
[C]. no
[D]. three

Answer: Option C

Explanation:

No answer description available for this question.

Sharmila said: (Aug 20, 2012)  
Why it does no take parameter?

Anuradha K said: (Oct 9, 2012)  
Constructor with no parameters or any number of parameters with default values is called default constructor.

constrctr()
or
constrctr( int a = 1, int b = 2 )

Himanshu Dixit said: (Jan 21, 2013)  
Compiler itself call constructor if no constructor is called with no parameter. Or if user provide constructor with zero parameter then compiler takes it.

Sathish said: (Mar 1, 2013)  
Why does not using of parameters ?

Animesh said: (Jul 11, 2013)  
If you supply a constructor with parameters then a default will not be created.

Vijayakumar said: (Oct 17, 2013)  
If it takes parameter it is not default constructor.

Yog Patil said: (Dec 29, 2013)  
Default constructor does not take any argument. its syntax is given as:

sample( )
{
x=0;
y=0;
}

Goral Patel said: (Jan 10, 2014)  
Default constructor we simply means that it has no argument. In this way we pass some argument then it is not default. But when this arguments with default values is called default cons.

Rohan said: (Feb 7, 2014)  
It does not take any arguments or parameters.

#include<iostream.h>
#include<conio.h>
class integer
{
private: //optional
int m,n;
public:
integer() //default consturctor
{
m=0;
n=0;
}
};
void mian()
{
integer i1; //object created
getch();
}

Sabyasachi Lenka said: (Feb 17, 2014)  
If there is any argument type constructor is present, then,

We have to declare constructor function for each and every class type objects passing argument.

In other case if object doesn't pass any value then compiler itself automatically construct a no argument type default constructor.

That's all.

Premchandar777 said: (Mar 18, 2014)  
The term default in the sense, it takes common value (default) when its not assigned.

Priyanka said: (Aug 4, 2014)  
Constructor does not contain any argument called default constructor.

Alok Raj said: (Sep 13, 2014)  
Default constructor uses default values if it is required. The sense of "if it is required" is in this sense guys if less argument is given then required then only it is used.

So if no argument is given that it will use default values. Thus default constructor.

Rohit Patil said: (Sep 27, 2015)  
But parameter constructor takes an argument.

Shivam said: (Sep 29, 2015)  
In that case if we pass any parameter in the default constructor that can not be acceptable in the constructor.

Chandani said: (Aug 14, 2016)  
The default constructor does not accept parameter because it is the default that does not accept a parameter.

Tahseen Ahmed said: (Aug 16, 2016)  
The correct answer is NO.

Because the default constructor is the constructor which is fired by the compiler when we declared the object in the main program and it allocates the memory to the object but does not give any value to it.

Venkataramana said: (Oct 22, 2016)  
The default constructor doesn't have any parameters because that is default created by the compiler at compile time. We no need to write a default constructor.

Shwetha said: (Oct 12, 2017)  
Here, we cannot passing any parameters into constructor.

Hariharan R said: (Jan 8, 2018)  
Whether parameters and arguments are different in meaning?

Vinaya said: (Jan 28, 2018)  
What is constructor?

Shree said: (Mar 24, 2018)  
Thanks for the explanation. It is very useful.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.