English

Which constructor initialises data members with default values? - Computer Applications

Advertisements
Advertisements

Question

Which constructor initialises data members with default values? 

Options

  • Parameterized constructor

  • Non-parameterized constructor

  • Copy constructor

  • Default constructor 

MCQ

Solution

Default constructor

Explanation:

A default constructor takes no parameters and sets the data members' default values (for example, 0 for numeric types, null for objects, and false for booleans). If a class does not have a constructor declared, the compiler will provide one by default.

shaalaa.com
  Is there an error in this question or solution?
Chapter 7: Constructors - EXERCISES [Page 417]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 7 Constructors
EXERCISES | Q I. 4. | Page 417
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×