मराठी

Distinguish between Parameterised constructor and Non-Parameterised constructor.

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. | पृष्ठ ४१५
Advertisements
Share
Notifications



      Forgot password?
Use app×