C++ Programming - Constructors and Destructors - Discussion

Discussion Forum : Constructors and Destructors - General Questions (Q.No. 8)
8.
Which of the following statement is incorrect?
Constructor is a member function of the class.
The compiler always provides a zero argument constructor.
It is necessary that a constructor in a class should always be public.
Both B and C.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
34 comments Page 3 of 4.

Kishore said:   1 decade ago
When we want to execute the particular part of the program we can declare constructor as private or protected.

Ashish said:   1 decade ago
Compiler provides default constructor with no argument.

Then how can 2nd option be incorrect?

Pran said:   1 decade ago
How this answer is possible, as a constructor is always defined in public section of a class ?

Myth said:   1 decade ago
Can any one say how many argument is provided by compiler to a constructor by default.

Radhika said:   1 decade ago
Constructor is a special member function of class. So ALL the statements are correct.

Aaryya said:   1 decade ago
Answer provided here is wrong because constructor must be declared in public section.

Kavitha josephine said:   1 decade ago
Is it necessary to specify access specifier to a constructor each time its created.

Kapil Bablani said:   1 decade ago
Construtor cannot be private nor protected. It can only be public. Its a fact.

Gaurav kumar garg said:   1 decade ago
Constractor must be public. If it is not public then compiler will give error.

Sujata said:   10 years ago
But compiler can automatically provide the default constructor.


Post your comments here:

Your comments will be displayed after verification.