Computer Science, asked by satyamagarwal6790, 10 months ago

Describe constructor along with its characteristics

Answers

Answered by bhaveshsingla1218200
0

Answer:

LG do GL GL DJ GL go do do j do p if p sh p fb ghj so so p

Explanation:

oh do UK GL fb GL

Answered by CopyThat
1

Explanation:

Constructor is a function that have the same name as the class and is

automatically invoked during creation of an object.

It is needed for:

a) Allocate memory space for an object.

b) Initialize data members within an object

Characteristics:

1. It has same name as the class-name.

2. It cannot have a return type, not even void is used, because

the implicit return type of a constructor is the class itself.

3. It follows the usual rules of accessibility as other members of

a class and therefore access modifiers can be applied to it.

4. It gets called automatically whenever an object is created.

5. It is usually used to initialize the members of the class with legal

initial values.

Similar questions