Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


why all c++ program must have default constructor?

Answers were Sorted based on User's Feedback



why all c++ program must have default constructor?..

Answer / ashutosh shashi

To initialized objects of class, if you do not create your
own.Its a inbuilt feature of C++ compiler.

Is This Answer Correct ?    7 Yes 1 No

why all c++ program must have default constructor?..

Answer / sourisengupta

When you create a Object with no arguments, the compiler automatically creates a default constructor internally. But when you use parameterized constructor in your code then you need to provide the default constructor in your code so that the compiler does not throw any errors at compile time.

It also depends on compiler. some compiler also supports this feature. then you do not need to write default constructor in the code.

Is This Answer Correct ?    5 Yes 1 No

why all c++ program must have default constructor?..

Answer / rahin99435

The purpose of constructor is to initialize the class members and allocate necessary resources for them; at runtime.So by default C++ compiler is provided with a default constructor which performs the same job at runtime while the object is created.
There is provision of defining more than one constructor by changing the signatures to get objects of different kind.

Is This Answer Correct ?    2 Yes 1 No

why all c++ program must have default constructor?..

Answer / jayakrishna

In c++ we have constructors for initialising the values for
the variables where destructors are present in order to
deallocate the the memory after completion of the work.

Is This Answer Correct ?    1 Yes 1 No

why all c++ program must have default constructor?..

Answer / varsha

Default constructor and destructor gice compilers a place to
hide the code such as invocation of contructors of Base
classes and non static data members.

Is This Answer Correct ?    0 Yes 1 No

why all c++ program must have default constructor?..

Answer / bhuvan singh

a defaulft constructor is created that takes no parameters
and does nothing.that takes no arguments but sets up your
object as required.

A defaulft constructor ,but by no convention so is any
constructor that takes parameters ,this is can be a bit confusing ,but is usually clear from context which one is meant.


A default constructor is not made by the compiler.so if u want a constructor that takes no parameters ,and u,ve created any others constructors ,u must make the default constructor urself.

"that if u make any constructor at all."

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More C++ General Interview Questions

Write about a nested class and mention its use?

0 Answers  


How can a '::' operator be used as unary operator?

1 Answers  


What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?

0 Answers  


What do you mean by function pointer?

0 Answers  


Profiler in projects?

2 Answers   Symphony,


What are the two shift operators and what are their functions?

0 Answers  


Why do we need runtime polymorphism in c++?

0 Answers  


why v use c++ even we have microprocessor

2 Answers   CybAge,


What is c++ coding?

0 Answers  


Differentiate between the manipulator and setf( ) function?

0 Answers  


What is prototype in c++ with example?

0 Answers  


Write a corrected statement in c++ so that the statement will work properly. if (x = y) x = 2*z;

2 Answers  


Categories