How do you differentiate between a constructor and normal function?

Questions by ykbharat   answers by ykbharat

Showing Answers 1 - 9 of 9 Answers


  • Mar 26th, 2007

functions have return type but constructors dont have return type.

  Was this answer useful?  Yes

A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. An ordinary member function has its own name, a return type (which may be void), and is invoked using the dot operator.


  • Sep 9th, 2013

Compare normal function and constructor

  Was this answer useful?  Yes


  • Apr 25th, 2014

when we create an object, the constructor is invoked and that constructor initializes the object of that class

  Was this answer useful?  Yes


  • Sep 18th, 2014

Constructor is a function which called automatically when a object of class is initialize, but a method is called when its explicit called by object

  Was this answer useful?  Yes

sunny jain

  • Dec 28th, 2014

first thing constructor has always same name as class name and it is call automatically when the first object of class is created.At the other side for function we need to call it by our-self.function has different name as also. 2 constructor not have any return type where function has.

  Was this answer useful?  Yes


  • Aug 20th, 2016

My question is, in our application when do we use a constructor and when do we use normal function?

  Was this answer useful?  Yes


  • Sep 28th, 2016

1) The method may or may not be present in the class
2) The method will be having the return type
3) The method is invoked with reference to object of the class

1) If you write or wont write any constructor then by default one constructor will be present with in the class
2) The constructor will not be having return type
3) The constructor will be called at the time of creation of object

  Was this answer useful?  Yes

Sumit Payasi

  • Oct 2nd, 2017

Constructor is an special function, which has same name as class name, constructor is an automatic initialization of object. constructor should not have any return type. constructor must be invoked with new operator.
normal function expose the behavior of object. function must have return type either its void or any return type. function should be called by object using its name.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions