Computer Science, asked by geetha72727, 10 months ago

What is the difference between constructor function and member function of a class

Answers

Answered by mouni43
12

Answer:

constructor function :

1) create and initialize objects

2) constructors are called implicitly [automatically ]with new keyword.

method function :

1) perform operations on objects

2) methods are called by using the object, before that objects are created by constructor

Answered by qwvilla
2

The  differences between constructor function and member function of a class are:

 CONSTRUCTOR

  • The class name must be the same as the name of the Constructor.
  • There is no return type value specification in Constructor.
  • The object is created automatically when the Constructors are invoked and are not called explicitly.

MEMBER FUNCTION OF A CLASS

  • The class name is not the same for the functions.
  • There is a return value specification in functions.
  • We use the class of the objects, and the functions are called explicitly.

Similar questions