ICSE Class 10 Computer Applications
Question 16 of 19
Constructors — Question 16
Back to all questions 16
Question Question 16
'Accessibility of a constructor greatly affects the scope and visibility of their class.' Elaborate this statement.
Every time an object is created, it is automatically initialised by the constructor of the class. Therefore, it is very much necessary for the constructor of a class to be accessible by the function in which the object is created. If the constructor of a class is declared 'private' or 'protected', then the scope and visibility of the constructor (and the class) is defined by the rules of the access specifier.
In such a case, a function not having access to constructor of a class cannot declare and use objects of that class. Hence, accessibility of a constructor greatly affects the scope and visibility of their class.