DEV Community

loading...

Which among them is used to create an object?

lakshyatyagi24 profile image Lakshya Tyagi ・1 min read

Write your answer in comment

1. A class
2. A function
3. A method
4. A constructor
Enter fullscreen mode Exit fullscreen mode

Discussion (2)

Collapse
sp96296 profile image
Evan H

A constructor is a method of a class that allows new objects to be made.

Collapse
varaprasad_gudi profile image
Gudi Varaprasad

A constructor.

The values assigned by the constructor to the class variables is used in creating an object.

Forem Open with the Forem app