Constructor Vs. Function – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-ICSE2017-03E #JAVA#7239    siteicon   siteicon  

Problem Statement - Constructor Vs. Function

Differentiate between constructor and function.

Solution

TC++ #7239

The constructor of a class is invoked automatically during object creation while a function is invoked manually after object creation.

A constructor is invoked only once while a function can be invoked multiple times.

A constructor has the same name as the class in which it is defined while a function can have any name.


Share

CSKC| Created: 15-Apr-2019 | Updated: 27-Nov-2019|ICSE2017









Back