0

whats the difference between, "Class object = new Class(); "and just "object = new Class();" ?

Convenient way of creating an object?

17th Jul 2018, 10:43 PM
Van Helsing
Van Helsing - avatar
1 ответ
+ 6
The former declares the object and assigns a dynamically created instance of the class to the object. The latter does not show object declaration, and will not work unless the object has been declared somewhere before the assignment happens. It's either Class obj = new Class(); or Class obj; obj = new Class();
18th Jul 2018, 1:40 AM
Hatsy Rei
Hatsy Rei - avatar