Can a default constructor in C++ have one argument? If so can someone give example for this?
Can a default constructor in C++ have one argument? If so can someone give example for this?
In fact a default constructor has no arguments in it and so in other words is also called as no argument constructor.So I think it is not possible for a default constructor to have one argument.
If a constructor has an argument it will no more be called a default constructor becaue default constructor is a special case of constructor which doesn't take any arguments. It is defined that way.
You can always pass an argument to the constructor. But, as soon as you do that, it is no more a default constructor!
Friends I think a constructor can have default arguments.Only if a constructor has any arguments that do not have default values, it is not a default constructor. This is just my idea. Post your thoughts on this.
Norman, if you had read all the replies for this thread you'd have realized whatever you have told has already been told by everyone.
We all know constructor can have arguments. The question was can Default constructor have arguments. Well, the answer everyone gave makes sense. (If the constructor has an argument, it won't be called default constructor)
[COLOR="Blue"][SIZE="2"]"If you are not living on the edge of your life, you are wasting space"[/SIZE][/COLOR]
Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"
hi
no default constructor cannot have one argument.
Remember when you donot explicitly define a constructor for a class,then java creates a Default constructor for the class.The default constructor automatically initializes all instance variables to "zero". Once u define ur own constructor ,the Default constr is no longer used.
A constructor with one parameter is called "paramerized constructor".
Hop thsi ans satisfies u.
bye
:)
NEVER SAY DIE.
No, Never. A default constructor can not have arguments..