हिंदी

Differentiate between local and member data.

Advertisements
Advertisements

प्रश्न

Differentiate between local and member data.

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

उत्तर

Feature Local data Member data
Declaration Location Declared inside a method, constructor, or block. Declared inside a class but outside any method.
Scope (Visibility) Restricted only to the specific method where it is declared. Accessible to all the methods within that class.
Lifetime Created when the method starts and destroyed when the method exits Created when an object is instantiated and destroyed with the object
Default Values No default values. Must be manually initialised before use. Automatically assigned default values (e.g., 0, 0.0, null, false).
Access Specifiers Cannot use access modifiers like public, private, etc. Can use access modifiers (public, private, protected, default).
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 3: User-Defined Methods - Exercises [पृष्ठ ९१]

APPEARS IN

रुपा पंडित Computer Applications [English] Class 10 ICSE
अध्याय 3 User-Defined Methods
Exercises | Q 4. (ii) | पृष्ठ ९१
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×