+ 1

What function "new" actually performs? Sorry if im being too silly to ask this.

24th Mar 2017, 9:12 AM
Sanyog Bhardwaj
Sanyog Bhardwaj - avatar
6 Answers
+ 2
"new" calls the constructor of a class
24th Mar 2017, 9:34 AM
T0nd3
+ 1
oh. thanks mate
24th Mar 2017, 10:15 AM
Sanyog Bhardwaj
Sanyog Bhardwaj - avatar
0
dayum son! does it call the constructor of a class or creates an object?
24th Mar 2017, 10:10 AM
Sanyog Bhardwaj
Sanyog Bhardwaj - avatar
0
both? then how do we tell the new method that when to either create an object or call a constructor?
24th Mar 2017, 10:12 AM
Sanyog Bhardwaj
Sanyog Bhardwaj - avatar
0
It does both at the same time. The method calls the constructor to initialize the attributes of the object and returns it at the end.
24th Mar 2017, 10:13 AM
merkrafter
- 1
The "new" method creates an object.
24th Mar 2017, 10:08 AM
merkrafter