हिंदी

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

Advertisements
Advertisements

प्रश्न

Distinguish between Parameterised constructor and Non-Parameterised constructor. 

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

उत्तर

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×
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.