Software-Engineering
August 29, 2024OOPS
August 29, 2024OOPS
Question 11 |
What should be the name of the constructor
same as object
| |
same as member | |
same as class | |
same as function |
Question 11 Explanation:
Constructor: a constructor (abbreviation: ctor) is a special type of subroutine called to create an object. A constructor resembles an instance method, but it differs from a method in that it has no explicit return type, it is not implicitly inherited and it usually has different rules for scope modifiers. Constructors often have the same name as the declaring class. They have the task of initializing the object’s data members
Correct Answer: C
Question 11 Explanation:
Constructor: a constructor (abbreviation: ctor) is a special type of subroutine called to create an object. A constructor resembles an instance method, but it differs from a method in that it has no explicit return type, it is not implicitly inherited and it usually has different rules for scope modifiers. Constructors often have the same name as the declaring class. They have the task of initializing the object’s data members