What is constructor? State any two characteristics.
Attachments:
Answers
Answered by
1
Answer:
In class-based object-oriented programming, a constructor (abbreviation: ctor) is a special type of subroutine called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables. ... Immutable objects must be initialized in a constructor.
Answered by
2
Answer:
Characteristics of constructor. They should be declared in the public section. They are invoked automatically when the objects are created. They do not have return (data type) type not even void and there for they cannot return any values.
Similar questions
Biology,
5 months ago
Biology,
5 months ago
Math,
5 months ago
Physics,
10 months ago
English,
10 months ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago