In c++ have a default constructor ?

Showing Answers 1 - 6 of 6 Answers

Richa

  • Sep 29th, 2005
 

Yes C++ does have a default constructor provided by the compiler.In this case all the members of the class are initialized to null values.These values act as the default values.For eg: MyClass me;In the above case since the object is not initialized to any value so the default constructor will be called which will initialize the class with the default values.

  Was this answer useful?  Yes

Jim

  • Oct 2nd, 2005
 

A default constructor is a constuctor that can be invoked without any arguments.  This could be a constructor without any parameters or a constructor that has parameters with default arguments.  Only one constructor in a class can have default arguments.

  Was this answer useful?  Yes

rajkishore

  • Oct 21st, 2005
 

yes, if the class designer donot define any constructor in the class. then the compiler provides the default constructor in the class.

m11aravind

  • Nov 10th, 2005
 

yes, In C++ we have a default constructor .

 A "default constructor" is a constructor that can be called with no arguments. One example of this is a constructor that takes no parameters

class Fred {
 public:
   Fred();   
// Default constructor: can be called with no args
   
...
 };
---by moparthi Aravind

ganga prasad rao.aloori

  • Nov 26th, 2005
 

yes in c++ a class can have a default constructor.a default constructor is  a constructor which doesn't pass any arguements to it.

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