हिंदी

Distinguish between Parameterised constructor and Non-Parameterised constructor. - Computer Applications

Advertisements
Advertisements

प्रश्न

Distinguish between Parameterised constructor and Non-Parameterised constructor. 

अंतर स्पष्ट करें
Advertisements

उत्तर

S. No. Parameterised constructor Non-Parameterised constructor
1. Using parametric values supplied when an object is created, it initializes the instance variables. It initializes an object's instance variables with predetermined values that are easily accessible within it.
2. Its parameter list contains formal parameters that define it. It has an empty argument list when defined.
3.

For example,

Test(int x, int y)
{
a = x;
b = y;
}

For example,

Test()
{
a = 10;
b = 5;
}
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 7: Constructors - EXERCISES [पृष्ठ ४१८]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
अध्याय 7 Constructors
EXERCISES | Q V. 8. | पृष्ठ ४१८
अविचल Computer Applications [English] Class 10 ICSE
अध्याय 7 Constructors
Review Insight | Q 1. | पृष्ठ ४१५
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×