Default Constructor

What is the Default Constructor?

Questions by haruninhyo

Showing Answers 1 - 6 of 6 Answers

VENKATGOPU

  • Jun 10th, 2009
 

The deafual constructor is a constructor. It may be contains arguemnets (default arquemnets) or It may not be contains arquemnet

Example

class A
{
     public:
               A(){/*body*/}                           //Deafult constructor without arquemnet      
   
                                                           or
            
              A(int a=0,int b=0){/*body*/}   //Default constructor with default arquement
};

if you did not write any constructor within class A. The implicit constructor or inline constructor A::A() /*[without no body] */ will be called when you create object for class A

Note: you can't use both constructor in same class. Confilict occur when you create object of class A that whether to call first one or second one (ambiguity)

Thanks & Regards
Venkat Gopu

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions