English

While creating a class, a specific method called constructor is defined to initialise the instance variables. Such method may or may not use parameters. - Computer Applications

Advertisements
Advertisements

Question

While creating a class, a specific method called constructor is defined to initialise the instance variables. Such method may or may not use parameters. In a case where the constructor is not defined in the class, the system creates on its own to put the default initial value to the instance variables. The initial values can also be duplicated from one instance to another. 

Based on the above discussion, answer the following questions:

  1. Which name resembles with the constructor name?
  2. What type of constructor is used with parameters?
  3. What type of constructor initialises the instance variables with default value?
  4. Which constructor is used to duplicate the initial values from one constructor to other? 
Case Study

Solution

  1. Class name
  2. Parameterised constructor
  3. Default constructor
  4. Copy constructor 
shaalaa.com
  Is there an error in this question or solution?
Chapter 7: Constructors - EXERCISES [Page 418]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 7 Constructors
EXERCISES | Q IV. | Page 418
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×
Our website is made possible by ad-free subscriptions or displaying online advertisements to our visitors.
If you don't like ads you can support us by buying an ad-free subscription or please consider supporting us by disabling your ad blocker. Thank you.