C++ Programming - Constructors and Destructors - Discussion

Discussion Forum : Constructors and Destructors - General Questions (Q.No. 1)
1.
A constructor that accepts __________ parameters is called the default constructor.
one
two
no
three
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
23 comments Page 1 of 3.

Rohan said:   1 decade ago
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:   1 decade ago
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.

Alok raj said:   1 decade ago
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.

Tahseen ahmed said:   9 years ago
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.

Goral patel said:   1 decade ago
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.

Anuradha K said:   1 decade ago
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 )

Venkataramana said:   9 years ago
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.

Himanshu dixit said:   1 decade ago
Compiler itself call constructor if no constructor is called with no parameter. Or if user provide constructor with zero parameter then compiler takes it.

Shivam said:   10 years ago
In that case if we pass any parameter in the default constructor that can not be acceptable in the constructor.

Chandani said:   9 years ago
The default constructor does not accept parameter because it is the default that does not accept a parameter.


Post your comments here:

Your comments will be displayed after verification.