English

Create a class with one integer instance. Initialize the variable using: Default constructor. - Computer Applications

Advertisements
Advertisements

Question

Create a class with one integer instance. Initialize the variable using: 

Default constructor.

Code Writing

Solution

class Sample 
{ 
int a; 
Sample() // Default constructor 
   { 
   a = 0; 
   }
}
shaalaa.com
  Is there an error in this question or solution?
Chapter 7: Constructors - Review Insight [Page 416]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 7 Constructors
Review Insight | Q 12. (i) | Page 416
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×